Exemple #1
0
        // Try to send a message to the Server
        public bool Send(Message Msg)
        {
            try
            {
                lock (Inner) // Thread safe
                    Msg.Serialise(Out);
            }
            catch
            {
                return false;
            }

            return true;
        }
Exemple #2
0
 // Send a message to a single client
 public void Send(Message m)
 {
     try
     {
         lock (Connection) // Thread safe
         {
             if (Connected)
                 m.Serialise(Out); // Serialise the message out
         }
     }
     catch
     {
         // If the send failed, treat it as a disconnect
         Disconnect(this, new DisconnectMessage(DisconnectType.Unexpected));
     }
 }