Example #1
0
        // Show the management GUI
        //        internal void ShowGUI(System.Windows.Forms.Form parent)
        //        {
        //            ManagementForm cf = new ManagementForm(clients);
        //            cf.ShowDialog(parent);
        //        }

        // Handle a Binary message
        internal void ReceiveMessage(byte[] data, TcpClient lSender, Server.Connection con)
        {
            // Check if this is the first message received
            if (!_clients.ContainsKey(lSender))
            {
                // A new connection must always start with a hello message, refuse the connection
                if (data[4] != (byte)2)
                {
                    lSender.GetStream().Close();
                    return;
                }
            }
            // Set the lSender field
            _sender     = lSender;
            _connection = con;
            // Parse and handle the message
            _binParser.Parse(data);
        }
Example #2
0
 // Show the management GUI
 //        internal void ShowGUI(System.Windows.Forms.Form parent)
 //        {
 //            ManagementForm cf = new ManagementForm(clients);
 //            cf.ShowDialog(parent);
 //        }
 // Handle an XML message
 internal void ReceiveMessage(string msg, TcpClient sender, Server.Connection con)
 {
     // Check if this is the first message received
     if(!clients.ContainsKey(sender))
     {
         // A new connection must always start with a <Hello> message.
         if(!msg.StartsWith("<Hello>", StringComparison.Ordinal))
         {
             // Refuse the connection
             sender.GetStream().Close(); return;
         }
     }
     // Set the sender field
     this.sender = sender;
     this.Connection = con;
     // Parse and handle the message
     xmlParser.Parse(msg);
 }
Example #3
0
 // Handle a binary message
 internal void ReceiveMessage(byte[] data, TcpClient sender,Server.Connection con)
 {
     // Check if this is the first message received
     if(!clients.ContainsKey(sender))
     {
         // A new connection must always start with a <Hello> xml message, refuse the connection
         sender.GetStream().Close(); return;
     }
     // Set the sender field
     this.sender = sender;
     this.Connection = con;
     // Parse and handle the message
     binParser.Parse(data);
 }
Example #4
0
 // Show the management GUI
 //        internal void ShowGUI(System.Windows.Forms.Form parent)
 //        {
 //            ManagementForm cf = new ManagementForm(clients);
 //            cf.ShowDialog(parent);
 //        }
 // Handle a Binary message
 internal void ReceiveMessage(byte[] data, TcpClient lSender, Server.Connection con)
 {
     // Check if this is the first message received
     if (!_clients.ContainsKey(lSender))
     {
         // A new connection must always start with a hello message, refuse the connection
         if (data[4] != (byte)2)
         {
             lSender.GetStream().Close();
             return;
         }
     }
     // Set the lSender field
     _sender = lSender;
     _connection = con;
     // Parse and handle the message
     _binParser.Parse(data);
 }