Hi
I'm trying to get some control over the speed I'm sending out packets in a
networking application. Using UDP sockets, if I send at full speed, I
eventually have packets that never make it on the network, as it appears
that my sending mechanism is faster than the card can send, and somewhere
along the network layer chain, a buffer overflows and drops packets I'm
sending down. Now I'd like to slow down the sending somewhat and I'm
wondering what might be the best way to do this. So far I put a sleep
between the sending of two packets, but since sleep is limited to
milliseconds, the level of control isn't too great and I doubt that any real
world app does bandwith management that way so I was thinking of the
following: I increase the default sending buffer to a respectable size, fill
it up at full speed, note how long it takes to send out all the packets,
then according to my speed requirements I wait a certain additional time
before starting to send out packets (and in the process fillling the sending
buffer of the socket) again.
Would that be the way to go at it, or are there other more accurate /
efficient ways to control the sending speed of an application?
Stephan
I'm trying to get some control over the speed I'm sending out packets in a
networking application. Using UDP sockets, if I send at full speed, I
eventually have packets that never make it on the network, as it appears
that my sending mechanism is faster than the card can send, and somewhere
along the network layer chain, a buffer overflows and drops packets I'm
sending down. Now I'd like to slow down the sending somewhat and I'm
wondering what might be the best way to do this. So far I put a sleep
between the sending of two packets, but since sleep is limited to
milliseconds, the level of control isn't too great and I doubt that any real
world app does bandwith management that way so I was thinking of the
following: I increase the default sending buffer to a respectable size, fill
it up at full speed, note how long it takes to send out all the packets,
then according to my speed requirements I wait a certain additional time
before starting to send out packets (and in the process fillling the sending
buffer of the socket) again.
Would that be the way to go at it, or are there other more accurate /
efficient ways to control the sending speed of an application?
Stephan