I have this System.Net.Sockets.TcpClient
. I can make a connection and write packets to it accurately. The problem is want to read the packets as it is (as caught by sniffers in the hex form like 0F 03 56 56 etc.)
I tried looking at examples of GetStream.write
but I fail to read them in such way. I also tried using a streamreader then convert the packets to hex but the thing I connect to sends screwed up packets which can't be converted or simple not in string form.
I hope I'm clear enough.
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
' Read can return anything from 0 to numBytesToRead.
' This method blocks until at least one byte is read.
netStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
' Returns the data received from the host to the console.
Dim returndata As String = Encoding.ASCII.GetString(bytes)