I am reading data from a RFID reader using network stream. But the length of the data is always 8193. What can I do to get the actual length.
Thanks in advance.
Dim tcpClient As New TcpClient("22.214.171.124", "10001")
Dim netStream As NetworkStream = TcpClient.GetStream()
If netStream.CanRead Then
' Reads the NetworkStream into a byte buffer.
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)
TextBox1.Text = ReturnData 'Length is always 8193
Console.WriteLine("You cannot read data from this stream.")
' Closing the tcpClient instance does not close the network stream.