Ejemplo n.º 1
0
 private void ClientConnectedLoop(Socket s)
 {
     try
     {
         while (!shouldStop)
         {
             byte[] b = new byte[100];
             if (s.Connected)
             {
                 int k = s.Receive(b);
                 if (k > 0) // The server receives an empty message when a connection is closed
                 {
                     ShutdownMessage message = ShutdownMessage.ReadMessage(b, k);
                     shutdownCollection.Add(message);
                 }
             }
         }
     }
     catch (SocketException)
     {
         ConnectedClients.Remove(s);
     }
 }
Ejemplo n.º 2
0
        private void consumer_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            ShutdownMessage message = e.UserState as ShutdownMessage;

            ExecuteShutdown(message.Interval, message.Type);
        }
Ejemplo n.º 3
0
 public void Transmit(ShutdownMessage msg)
 {
     Console.WriteLine("Transmitting");
     byte[] b = msg.GetMessage();
     stream.Write(b, 0, b.Length);
 }