inhahe
May 28th, 2008, 03:54 AM
I'm trying to program a server using i/o completion ports. I want GetQueuedCompletionStatus to tell me when sockets are available for writing, i.e. when they're not going to block if I write to them (among other things). But I don't know a) if it does this, or b) how to make it do this, and if I can, c) how to tell whether it's returning a socket because it has become writable. It seems all the juicy information is returned in the OVERLAPPED structure, but I can't figure out anything about it from reading Microsoft's documentation on it. Also I'd like to know d) where in that structure it returns the socket's file descriptor; I.e., it'd be nice to know which socket it's telling me about.
I'm also wondering e) when exactly is it that a socket write operation will block? Does the OS buffer up to a certain point, and then block if it's too much? And f) how do I tell whether it's going to block or not if I try to write to a socket before I write to it, or how much I can write before that happens? And g) if you write 1000000 bytes to one socket, and 1000000 bytes to another socket, and the OS buffers it, will it write to the sockets in the background in an interleaved fashion, or will it send all of the former, then all of the latter?
thanks for your response.
I'm also wondering e) when exactly is it that a socket write operation will block? Does the OS buffer up to a certain point, and then block if it's too much? And f) how do I tell whether it's going to block or not if I try to write to a socket before I write to it, or how much I can write before that happens? And g) if you write 1000000 bytes to one socket, and 1000000 bytes to another socket, and the OS buffers it, will it write to the sockets in the background in an interleaved fashion, or will it send all of the former, then all of the latter?
thanks for your response.