Ejemplo n.º 1
0
 /// <summary>
 /// Client has made connection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnClientConnected(object sender, Gurux.Common.ConnectionEventArgs e)
 {
     if (Trace > TraceLevel.Warning)
     {
         Console.WriteLine("Client Connected.");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Client has made connection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnClientConnected(object sender, Gurux.Common.ConnectionEventArgs e)
 {
     //Show trace only for one meter.
     if (Trace > TraceLevel.Warning && (!Exclusive || serialNumber == 1))
     {
         Console.WriteLine("TCP/IP connection established.");
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Client has close connection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnClientDisconnected(object sender, Gurux.Common.ConnectionEventArgs e)
 {
     //Reset server settings when connection closed.
     this.Reset();
     if (Trace > TraceLevel.Warning)
     {
         Console.WriteLine("Client Disconnected.");
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Client has made connection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void OnClientConnected(object sender, Gurux.Common.ConnectionEventArgs e)
 {
     //Show trace only for one meter.
     if (Trace > TraceLevel.Warning)
     {
         Console.WriteLine("TCP/IP connection established.");
     }
     //Clear the buffer.
     if (buffers.ContainsKey(e.Info))
     {
         buffers[e.Info].Clear();
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Client has made a connection to the server.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal static void OnClientConnected(object sender, Gurux.Common.ConnectionEventArgs e)
        {
            Console.WriteLine("Client {0} is connected.", e.Info);
            GXNet server = (GXNet)sender;

            try
            {
                GXNet  media  = server.Attach(e);
                Thread thread = new Thread(new ParameterizedThreadStart(ReadMeter));
                thread.Start(media);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Client has made connection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnClientConnected(object sender, Gurux.Common.ConnectionEventArgs e)
 {
     Console.WriteLine("Client Connected.");
 }
Ejemplo n.º 7
0
 void OnClientConnected(object sender, ConnectionEventArgs e)
 {
     foreach (var it in Handlers)
     {
         it.Key.ClientConnected(e.Info);
     }
     //TODO: throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// When new client has disconnected in server mode.
 /// </summary>
 private void Net1_OnClientDisconnected(object sender, ConnectionEventArgs e)
 {
     try
     {
         if (this.InvokeRequired)
         {
             this.BeginInvoke(new ClientDisconnectedEventHandler(Net1_OnClientDisconnected), new object[] { sender, e });
         }
         else
         {
             //Find client and remove it from the list.
             int pos = ClientsList.FindStringExact(e.Info);
             if (pos != -1)
             {
                 ClientsList.Items.RemoveAt(pos);
             }
             else
             {
                 ErrorList.Items.Add("Failed to find item: " + e.Info);
             }
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// When new client has connected in server mode.
 /// </summary>
 private void Net1_OnClientConnected(object sender, ConnectionEventArgs e)
 {
     try
     {
         if (this.InvokeRequired)
         {
             this.BeginInvoke(new ClientConnectedEventHandler(Net1_OnClientConnected), new object[] { sender, e });
         }
         else
         {
             ClientsList.Items.Add(e.Info);
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message);
     }
 }