title: How network event FD_WRITE is generated when using Event Driven Sockets?
body: <p>I am working on newtwork event based socket application. </p>
  
  <p>When client has sent some data and there is something to be read on the socket, FD_READ network event is generated.</p>
  
  <p>Now according to my understanding, when server wants to write over the socket, there must be an event generated i.e. FD_WRITE. But how this message will be generated? </p>
  
  <p>When there is something available to be read, FD_READ is automatically generated but what about FD_WRITE when server wants to write something?  </p>
  
  <p>Anyone who can help me with this confusion please?  </p>
  
  <p>Following is the code snippet:</p>
  
  <pre><code>WSAEVENT hEvent = WSACreateEvent();
  WSANETWORKEVENTS events;
  WSAEventSelect(newSocketIdentifier, hEvent, FD_READ | FD_WRITE);
  
     while(1)
        {   //while(1) starts
           waitRet = WSAWaitForMultipleEvents(1, &amp;hEvent, FALSE, WSA_INFINITE, FALSE);
           //WSAResetEvent(hEvent);
           if(WSAEnumNetworkEvents(newSocketIdentifier,hEvent,&amp;events) == SOCKET_ERROR)
              {
                //Failure
              }
       else
          {   //else event occurred starts
              if(events.lNetworkEvents &amp; FD_READ)
              {
                              //recvfrom()   
              }
              if(events.lNetworkEvents &amp; FD_WRITE)
              {
                   //sendto()
              }
          }
        }
  </code></pre>