コード例 #1
0
 /// <summary>
 /// method that sends the speciefied message with the specified serial, and executes the given action upon receivind a reply from the server with this serial.
 /// </summary>
 /// <param name="stream">the networkstream to use</param>
 /// <param name="message">the message to send</param>
 /// <param name="serial">the serial to check for</param>
 /// <param name="action">the code to be executed upon reveiving a reply from the server with the specified serial</param>
 public void SendMessageAndOnResponse(string message, string serial, HandleSerial action)
 {
     if (serialResponses.ContainsKey(serial))
     {
         serialResponses[serial] = action;
     }
     else
     {
         serialResponses.Add(serial, action);
     }
     WriteTextMessage(message);
 }
コード例 #2
0
 /// <summary>
 /// method that sends the speciefied message with the specified serial, and executes the given action upon receivind a reply from the server with this serial.
 /// </summary>
 /// <param name="stream">the networkstream to use</param>
 /// <param name="message">the message to send</param>
 /// <param name="serial">the serial to check for</param>
 /// <param name="action">the code to be executed upon reveiving a reply from the server with the specified serial</param>
 public static void SendMessageAndOnResponse(NetworkStream stream, string message, string serial, HandleSerial action)
 {
     serialResponses.Add(serial, action);
     WriteTextMessage(stream, message);
 }