Click here to Skip to main content
13,868,417 members
Rate this:
Please Sign up or sign in to vote.
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...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190214.1 | Last Updated 28 Aug 2010
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100