469,117 Members | 1,364 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,117 developers. It's quick & easy.

Strange problem with System.Net.Sockets.TcpClient()

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
--
In the force if Yoda's so strong, construct a sentence with words in the
proper order then why can't he?
Nov 18 '05 #1
0 1760

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by myhyli | last post: by
4 posts views Thread by Sueffel | last post: by
reply views Thread by Tim Wagaman | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.