指定されたポートを持つリモート サーバーに tcpclient を使用してメッセージを送信しようとしています。私のコードでは、接続が成功し、メッセージが送信されていることがわかりますが、相手側の開発者からメッセージが受信されていないことが通知されます。これをデバッグする方法はありますか?
Public Sub New(ip As String, port As Integer)
_GLOIP = IPAddress.Parse(ip)
_port = port
'initiate the client and get the stream to use
myTcp = initiate()
netStream = myTcp.GetStream()
End Sub
Public Sub send(text As String, ByRef err As String)
If netStream.CanWrite Then
If Not text.EndsWith(vbCr & vbLf) Then
text += Environment.NewLine
End If
Dim sendBytes As Byte() = Encoding.UTF8.GetBytes(text)
netStream.Write(sendBytes, 0, sendBytes.Length)
Else
err = "cannot write to the stream"
End If
End Sub
Public Function initiate() As TcpClient
Dim TcpClient As New TcpClient()
Dim bytCommand As Byte() = New Byte(1023) {}
TcpClient.Connect(_GLOIP, _port)
Return TcpClient
End Function