Exemple #1
0
 /// <summary>
 /// This method automatically handles the exception thrown by the non blocking socket when accept is called.
 /// It uses the scheduler to execute the callbacks
 /// This just doesn't do anything if no new connections are coming
 /// Suggestion: use accept in a separate thread
 /// </summary>
 public void Accept()
 {
     try
     {
         var incomingSocket = NetSocket.Accept();
         if (onIncomingConnectionAccepted != null)
         {
             cachedScheduler.Schedule(() => onIncomingConnectionAccepted(incomingSocket));
         }
     }
     catch (Exception ex)
     {
     }
 }