3

In the context of Overlapped I/O, WSASend() can return the error code WSAEWOULDBLOCK, which says:

Overlapped sockets: There are too many outstanding overlapped I/O requests.

Is the maximum number of outstanding overlapped I/O requests defined, or does it depend on many criteria such as memory available, Windows version, etc.

Tom
  • 1,344
  • 9
  • 27
  • 1
    No idea, but generally speaking you should design your code so that there are only a few outstanding overlapped I/O requests on a given socket at any time. In most cases two should be enough - the one that is currently active plus one more. By the time the second one is finished you'll usually have had time to issue another one. – Harry Johnston Mar 05 '15 at 20:23
  • @Harry Johnston But what if the user issued 10 send requests, should I queue these requests and send them one at a time? – Tom Mar 05 '15 at 23:44
  • IME, tens of thousands, (across all sockets) – Martin James Mar 06 '15 at 04:31
  • 1
    @HarryJohnston: That's a good plan for TCP where an operation is "completed" when it's copied into the kernel's send buffer. But an overlapped UDP send is only considered "complete" when the packet actually hits the hardware (i.e. the send buffer is effectively disabled), so you *must* juggle lots of outstanding send requests at the same time if you want non-dismal performance. (It would be nice if WSAEWOULDBLOCK at least told you when you had enough requests outstanding; no idea if that's true though. Stumbled on this question while searching for more information on that :-).) – Nathaniel J. Smith Jan 22 '17 at 07:46
  • @NathanielJ.Smith: it isn't really the kernel buffer that matters, it's how much data you can send in a single call. The upshot is the same though as far as UDP is concerned. From what I've read, you should probably be using registered I/O if at all possible, but that is only available in Windows 8 or later. – Harry Johnston Jan 22 '17 at 21:26

0 Answers0