Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I set
sc.setSocketOption(sc.RCVBUF, 163840);

but can receive only 16384. Is it maximum what I can receive at once?

How it looks practically:
If response from server contains 20000 bytes, then application performs 16384 bytes, and when I send another or same(doesn't matter) request again, then application performs next 3616 bytes, that was left after first time, it means, that this data were stored somewhere...
Posted

1 solution

It seems that you are using TCP protocol. If you are using TCP protocol, data is stored in a buffer until you read it i.e. if u recieved 1000 bytes but you only read 400 bytes, the next time you read the remaining 600 bytes will be available. Also, if you receieve data that is more than your buffer size, the server will be notified so that data does not get lost in between.

On the other hand, if you are using UDP protocol (connectionless), when you receive data that is more than your buffer size, data will be lost.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900