[Libevent-users] Re: IOCP writes

Toby Douglass toby.douglass at summerblue.net
Thu Feb 22 16:01:00 EST 2007


Toby Douglass wrote:
> William Ahern wrote:
>> On Thu, Feb 22, 2007 at 01:43:48PM -0000, Toby Douglass wrote:

>>> However, the example I had in mind (which is similar) is P2P apps, which
>>> use writes on a single local UDP socket to send peering information to
>>> peers.  They would benefit from async writes on that socket.
>>
>> Writing to a UDP socket should never block, period. If the output 
>> buffer is
>> full, and you write another message, it should force the stack to drop a
>> message.
> 
> Good point.  I'd forgotten about that.

However, I've just realized that it may make no difference.

Writing to a UDP socket should never block; agreed.

However, that multiple concurrent writes (one socket, many writer 
threads) can occur, and so the internal mechanics of the IOCP API must 
support that behaviour (assume we have enough bandwidth and the write 
rate is low enough that we're not dropping packets).

If I only have a single overlapped structure for writes, I cannot 
support that behaviour.

So I have to malloc the overlapped structure per write (or have the user 
pass one in).



More information about the Libevent-users mailing list