Skip to content

Instantly share code, notes, and snippets.

@parachvte
Created October 21, 2014 17:29
Show Gist options
  • Save parachvte/61737700d3520a7bf300 to your computer and use it in GitHub Desktop.
Save parachvte/61737700d3520a7bf300 to your computer and use it in GitHub Desktop.
[Network Programming] Homework 2
请比较select模型与WSAEventSelect模型两者之间的差异?
Deadline: Oct 27, 2014
@parachvte
Copy link
Author

  1. Compatibility: select() works on any platform with BSD sockets, and WSAEventSelect only works on platform with Winsock.

  2. Mechanism:

    • In order to avoid polling, the select model blocks a thread and examines if something interesting happening to 3 fd_sets(readfds, writefds and errorfds), and if necessary, performs synchronous I/O.
    • Instead, WSAEventSelect model binds each socket to an Event object. Once network events(FD_XXX) are occur, events are set to be signaled. Call the WSAWaitForMultipleEvents() function to return the index of signaled event objects.

    To summarize, select model is ACTIVE, and WSAEventSelect model is PASSIVE. So WSAEventSelect model works much faster than select model does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment