/// <summary>
 /// Callback method to handle received messages.  The AsyncSocketClient
 /// library calls this; don't call it yourself.
 /// </summary>
 /// <param name="client">The client to receive messages from.</param>
 internal void ClientMessageHandler(AsyncSocketClient client)
 {
     try
     {
         // OPTIMIZE: Use a single PduFactory instance, instead of a new one each time.
         Queue responseQueue = new PduFactory().GetPduQueue(client.Buffer);
         ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessPduQueue), responseQueue);
     }
     catch (Exception exception)
     {
         DispatchOnError(new CommonErrorEventArgs(exception));
     }
 }
示例#2
0
 /// <summary>
 /// Callback method to handle received messages.  The AsyncSocketClient
 /// library calls this; don't call it yourself.
 /// </summary>
 /// <param name="client">The client to receive messages from.</param>
 internal void ClientMessageHandler(AsyncSocketClient client)
 {
     try
     {
         Queue responseQueue = new PduFactory().GetPduQueue(client.Buffer);
         ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessPduQueue), responseQueue);
     }
     catch (Exception exception)
     {
         if (OnError != null)
         {
             CommonErrorEventArgs e = new CommonErrorEventArgs(exception);
             OnError(this, e);
         }
     }
 }