示例#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.");
     }
 }
示例#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.");
     }
 }
示例#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.");
     }
 }
 /// <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();
     }
 }
示例#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);
            }
        }
示例#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.");
 }
 void OnClientConnected(object sender, ConnectionEventArgs e)
 {
     foreach (var it in Handlers)
     {
         it.Key.ClientConnected(e.Info);
     }
     //TODO: throw new NotImplementedException();
 }
示例#8
0
文件: Form1.cs 项目: Gurux/Gurux.Net
 /// <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);
     }
 }
示例#9
0
文件: Form1.cs 项目: Gurux/Gurux.Net
 /// <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);
     }
 }