B
Brett
For some reason when I step into the code below, it jumps out on the second
iteration at the line I have marked below. Nothing else happens - no
errors.
Dim tcpClient As New System.Net.Sockets.TcpClient
tcpClient.Connect("127.0.0.1", 9005)
While True
Dim networkStream As NetworkStream = tcpClient.GetStream()
'If networkStream.CanWrite And networkStream.CanRead Then
' Do a simple write.
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody
there")
networkStream.Write(sendBytes, 0, sendBytes.Length)
' Read the NetworkStream into a byte buffer.
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
' Output the data received from the host to the console.
Dim returndata As String = Encoding.ASCII.GetString(bytes)
Step into jumps out at above line. The rest of the code follows:
Console.WriteLine(("Host returned: " + returndata))
' pause so user can view the console output
Console.ReadLine()
End While
tcpClient.Close()
There is a server version of the app that is sending data. Any suggestions
on how I can trace this down?
Thanks,
Brett
iteration at the line I have marked below. Nothing else happens - no
errors.
Dim tcpClient As New System.Net.Sockets.TcpClient
tcpClient.Connect("127.0.0.1", 9005)
While True
Dim networkStream As NetworkStream = tcpClient.GetStream()
'If networkStream.CanWrite And networkStream.CanRead Then
' Do a simple write.
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody
there")
networkStream.Write(sendBytes, 0, sendBytes.Length)
' Read the NetworkStream into a byte buffer.
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
' Output the data received from the host to the console.
Dim returndata As String = Encoding.ASCII.GetString(bytes)
Step into jumps out at above line. The rest of the code follows:
Console.WriteLine(("Host returned: " + returndata))
' pause so user can view the console output
Console.ReadLine()
End While
tcpClient.Close()
There is a server version of the app that is sending data. Any suggestions
on how I can trace this down?
Thanks,
Brett