Overlapped I/O and Completion Port :: Winsock

This is a discussion on Overlapped I/O and Completion Port :: Winsock within the Windows Programming forums, part of the Platform Specific Boards category; Hi. Okay. I am considering Overlapped I/O and Completion Port I/O models as more robust non-blocking I/O for a Winsock ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Overlapped I/O and Completion Port :: Winsock

    Hi.

    Okay. I am considering Overlapped I/O and Completion Port I/O models as more robust non-blocking I/O for a Winsock program. Currently I use WSAAsyncSelect. I have some essential questions about the two I/O model.

    - Overlapped I/O

    Okay. I understand Overlapped I/O with respect to both the event and completion routine. I believe that a primary reason that the completion routine solution of an Overlapped I/O model is more powerful that the event solution is simplicity. For example, the event solution is limited to 64 sockets per worker threads.

    Under both solutions and especially the completion routine, how do you associate the socket that caused the overlapped I/O to call the completion routine? In other words, let say socketXYZ triggered overlapped I/O to call its completion routine function. How do you determine inside the routine function that is performing send, recv, etc. on socketXYZ?

    - Completion Port I/O

    This is really a powerful I/O model and is hands down the best I/O model under NT and newer versions of Windows. I have three essential questions.

    1) Lets say there are exactly ten active sockets associated with a completion port. As each socket become inactive via user disconnect, error, etc., how do you know when there are no sockets (zero socket) associated with the completion port? In other words, if you wanted to close a completion port when no socket is associated with it, How do you know when there is no socket associate with it?

    2) Given that the call to GetQueuedCompletionStatus() return FALSE (failed), How would you know what sockets to close during cleanup since the completion port had crashed?

    -----

    Under either Overlapped I/O or Completion Port I/O how do you know when to connect, send, receive, etc. data? For example, in WSAAsyncSelect and WSAAsynEvent, you can can AND check FD_SEND, FD_READ, etc. However, in Overlapped I/O or Completion Port I/O, how do you know if there is data available or when the host/client is ready for you to send data?

    Thanks,
    Kuphryn
    Last edited by kuphryn; 10-30-2002 at 04:17 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Having Buffer Problems With Overlapped I/O --
    By Sargera in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 03:46 PM
  2. Completion Port and Multithreads :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 11-06-2002, 10:37 PM
  3. I/O Completion Port and Queue Status :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 11-02-2002, 12:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21