• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Capping of sockets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capping of sockets


  • Subject: Re: Capping of sockets
  • From: james woodyatt <email@hidden>
  • Date: Fri, 9 Jun 2006 16:17:57 -0700

On Jun 9, 2006, at 15:30, David Aames wrote:

Thanks for your insightful reply. I think I will manage to implement rate limitting for uploading. I've also just found an article (http://doc.trolltech.com/qq/qq17-ratecontrol.html ) which implements up/down rate limitting. The interesting part is where they set a maximum buffer of the socket - if this is reached the socket will stop receiving data. Is this even possible with BSD sockets? Or I would have to resort to kernel extensions?

Use the SO_RCVBUF socket option to set the size of the receive buffer in the kernel. That's what the Trolltech code is doing underneath the layer they published in that article. Depending on the nature of your application protocol, you may also need to set the receive low water mark with SO_RCVLOWAT.


Be aware that these options do not actually force the sender to slow down-- they only control the size of the window your end advertises and when your application will be signaled to read more octets. In practice, though, it means that if the sender is respecting the TCP window, then you can use these options as a crude hammer with which to limit its rate over relatively long time intervals.

All this stuff is covered in detail in _Unix Network Programming_ <http://www.kohala.com/start/unpv12e.html>. The setsockopt(2) man page has the nut.


-- james woodyatt <email@hidden> member of technical staff apple computer, inc.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Capping of sockets
      • From: David Aames <email@hidden>
References: 
 >Re: Capping of sockets (From: Scott Ribe <email@hidden>)
 >Re: Capping of sockets (From: David Aames <email@hidden>)
 >Re: Capping of sockets (From: james woodyatt <email@hidden>)
 >Re: Capping of sockets (From: "David Aames" <email@hidden>)

  • Prev by Date: Re: Capping of sockets
  • Next by Date: Re: Capping of sockets
  • Previous by thread: Re: Capping of sockets
  • Next by thread: Re: Capping of sockets
  • Index(es):
    • Date
    • Thread