I am building an application in which sends an outside server data, it then shoots back data which pertains to what I sent. The problem that I am having is that the maximum amount of bytes tha will come back is 8001. The program works fine as long as the return byte value is less then 8001. Something with the max value sounds familiar but I can not pin point it. What else could I do to receive the rest of the data?

This code snippet is where im getting problem

Dim bytesSent As Integer = sender1.Send(data)
 Dim bytes(64000) As Byte
Dim bytesRec As Int64
 
'**** Where the problem happens
bytesRec = sender1.Receive(bytes)
'****
Dim response As String = Encoding.ASCII.GetString(bytes, 0, bytesRec)

Console.WriteLine("Response: " + response)

 writetofileCLUE(response)

See ASP Net - Strange problem with System.Net.Sockets.TcpClient(). There's the same problem solved.
The point is to read data in a small blocks in a loop to a buffer, and to check how many bytes you've received in each loop.
After all the data is read, convert byte buffer to a string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.