T
Torsten Brasch
Hi All and Happy New Year
I have a very strange problem with System.Net.Sockets.TcpClient().
For some reason, the number of bytes I can receive is limited to 5460 bytes.
I made sure that the server really sends everything I expect it to send. I
am actually sending XML messages and this limit is a pain in the ...
Here is the code:
--------------------------------------------------------------------------
Dim tcpclient As New System.Net.Sockets.TcpClient()
tcpclient.Connect(Server_IP, portNumber)
Dim NWStream As NetworkStream = tcpclient.GetStream
Dim bytesToSend As Byte() = Encoding.ASCII.GetBytes(pInText)
'---send the text
NWStream.Write(bytesToSend, 0, bytesToSend.Length)
'---read back the text
Dim bytesToRead(tcpclient.ReceiveBufferSize) As Byte
' HERE IS THE PROBLEM - numBytesRead for some reason is limited to 5460
bytes
Dim numBytesRead As Int32 = NWStream.Read(bytesToRead, 0,
tcpclient.ReceiveBufferSize)Result = Encoding.ASCII.GetString(bytesToRead,
0, numBytesRead)
tcpclient.Close()
--------------------------------------------------------------------------
I would very much appreciate if somebody had a clue of what is going on
here.
Thanks,
Torsten
I have a very strange problem with System.Net.Sockets.TcpClient().
For some reason, the number of bytes I can receive is limited to 5460 bytes.
I made sure that the server really sends everything I expect it to send. I
am actually sending XML messages and this limit is a pain in the ...
Here is the code:
--------------------------------------------------------------------------
Dim tcpclient As New System.Net.Sockets.TcpClient()
tcpclient.Connect(Server_IP, portNumber)
Dim NWStream As NetworkStream = tcpclient.GetStream
Dim bytesToSend As Byte() = Encoding.ASCII.GetBytes(pInText)
'---send the text
NWStream.Write(bytesToSend, 0, bytesToSend.Length)
'---read back the text
Dim bytesToRead(tcpclient.ReceiveBufferSize) As Byte
' HERE IS THE PROBLEM - numBytesRead for some reason is limited to 5460
bytes
Dim numBytesRead As Int32 = NWStream.Read(bytesToRead, 0,
tcpclient.ReceiveBufferSize)Result = Encoding.ASCII.GetString(bytesToRead,
0, numBytesRead)
tcpclient.Close()
--------------------------------------------------------------------------
I would very much appreciate if somebody had a clue of what is going on
here.
Thanks,
Torsten