Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  gen_tcp and the undocumented buffer option

rikshot
Posted: Tue Mar 24, 2009 2:05 am Reply with quote
Joined: 24 Mar 2009 Posts: 1
I'm trying to control the amount of data that gen_tcp sends when the socket is set to active mode. It seems that the undocumented 'buffer' option controls the limit when gen_tcp send a message. The default value is 1460. When I set the buffer option to something smaller than the default value, it does whats expected, and limits the message size to for example 1024. However, when I change the value something larger than the default, for example 2048, it still limits the messages sent to the default 1460 value. What's going on? Is this a bug or should I be setting something else also?
View user's profile Send private message
uwiger
Posted: Tue Mar 24, 2009 4:36 pm Reply with quote
User Joined: 03 Jul 2006 Posts: 604 Location: Sweden
rikshot wrote:
I'm trying to control the amount of data that gen_tcp sends when the socket is set to active mode. It seems that the undocumented 'buffer' option controls the limit when gen_tcp send a message.


Answer relayed from Erlang/OTP guru Raimo Niskanen:

Try and play with the options 'sndbuf', 'recbuf', and 'buffer'. Use inet:getopts to see what they are per default.

'buffer' is the size of the buffer used by the inet driver when receiving data from the kernel.
'sndbuf' and 'recbuf' corresponds to the socket options SO_SNDBUF and SO_RCVBUF. See the man pages; they say (socket(7) on SLES 10) something about returning the double size with getsockopt... Strange.

Furhermore, the inet driver adjusts the 'buffer' value so it is no less than the 'sndbuf' and 'recbuf' values when you change them, making things even more interesting.

You can also count on TCP destroying any assumtion you can have on the size of the received blocks. All you can depend on is that the bytes comes in the order as sent.
View user's profile Send private message Visit poster's website
rbucker881
Posted: Wed Apr 01, 2009 8:48 pm Reply with quote
User Joined: 11 Oct 2007 Posts: 17
I have not looked at this issue.... however, 1460 rings a bell. I think it's one of those magic numbers that might sync with the MTU.

/r
View user's profile Send private message
wuji
Posted: Mon Aug 13, 2012 7:04 am Reply with quote
User Joined: 10 Aug 2012 Posts: 654
Anderson has ordered a review of police response to the the imitation designer *beep* the incident.Luther was remembered as an "awesome guy" and was
well loved," Jay Allis, the kitchen manager at the restaurant, restaurant, cheap polo shirts restaurant, told ABC News' Nashville affiliate WKRN.A recording at the
East Cafe said it would remain closed for "an indeterminate indeterminate jordan 6s indeterminate amount of time due to a tragedy in out
Cafe family."Police Pursuits in California Have Injured More Than 10,000Nearly 10,000Nearly jordan 6 10,000Nearly 90 Percent of Pursuits are for Non-Violent OffensesBy DAVID
19, 2012 More bystanders are injured or killed during high-speed high-speed [h3]cheap polo ralph lauren[/h3] high-speed police chases than by stray bullets. In California, more
10,000 people have been injured and over 300 people killed killed [h4]cheap designer *beep*[/h4] killed because of police chases in the last decade, according
newly released statistics from the California Highway Patrol.Nationally, it's estimated estimated [h2]jordan 6[/h2] estimated nearly 300 people die each year as a result
View user's profile Send private message
wantjersey
Posted: Fri Aug 17, 2012 6:06 am Reply with quote
User Joined: 17 Aug 2012 Posts: 10
When a person as an individual or as a fan goes for buying the above branded cheap jerseys, he should check for the MLB logo on the jersey proper stitching and other signs of replica jerseys cheap mlb jerseys. These are available from the MLB store as well as from various authorized dealers who sell on eBay.at cheap cheap mlb wholesale nba jerseys and discounted rates sometimes during the season and surely in the off season.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum