Exemple #1
0
        void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            try
            {
                bool       PLCComm = false; bool CoderComm = false; bool RobotComm = false;
                IPEndPoint ClientIP = e.TcpClient.Client.RemoteEndPoint as IPEndPoint;
                if (ClientIP.Address.ToString() == Properties.Settings.Default.样件架PLC端)
                {
                    clientPLC = e.TcpClient;
                    PLCComm   = true;
                }
                if (ClientIP.Address.ToString() == Properties.Settings.Default.拉力机PLC端)
                {
                    clientCoder = e.TcpClient;
                    CoderComm   = true;
                }

                if (ClientIP.Address.ToString() == Properties.Settings.Default.Robot端)
                {
                    clientRobot = e.TcpClient;
                    RobotComm   = true;
                }
                if (PLCComm && CoderComm && RobotComm)
                {
                    LogRefresh(ipC.iPConfig[ClientIP.Address.ToString()] + e.TcpClient.Client.RemoteEndPoint.ToString() + "  has connected.", null, dic["测试命令模式"]);
                    BeginInvoke(new CheckStateControlDelegate(CheckStateControl), new Object[] { PlatformStatusClassifier.StatusClassifier(Params.ProcessName.Communication) });
                }
            }
            catch (Exception ex) { log.Exception(ex); }
        }
Exemple #2
0
        private void ClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            var key = e.Session.RemoteEndPoint.ToString();

            Sessions.AddOrUpdate(key, e.Session, (k, o) => o);
            Console.WriteLine($"客户端 {e.Session.RemoteEndPoint} 已连接 {e.Session}.");
        }
Exemple #3
0
        /// <summary>
        /// 建立客户端连接事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tcpServer_ClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            var remoteEndPoint = e.TcpClient.Client.RemoteEndPoint.ToString();

            Dispatcher.BeginInvoke((Action) delegate {
                lbClient.Items.Add(remoteEndPoint);
            });
        }
Exemple #4
0
        /// <summary>
        /// 连接成功后消息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            //加入到连接池中
            Console.WriteLine("连接成功;key:" + e.Session.SessionKey);

            AllConnectionKey.Add(e.Session.SessionKey, e.Session);

            writeLogs("连接成功;key:" + e.Session.SessionKey);
        }
Exemple #5
0
 private void ClientConnect(object sender, TcpClientConnectedEventArgs e)
 {
     foreach (var item in server.Connections)
     {
         CommonModules.ControlSafeOPeration.CtrlSafeOperation.InvokeSafeOperation(listBox1, () =>
         {
             listBox1.Items.Add(string.Format("{0}:{1}", item.Address[0], item.Port));
         });
     }
 }
Exemple #6
0
        public override void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            string str = string.Format("小车通信程序连接成功,", e.Session.RemoteEndPoint);

            Console.WriteLine(str);
            OnMessageEvent(this, new MessageEventArgs(str));

            //string pathAgv = ConstString.AGV_PATH;
            //SendTo(e.Session.SessionKey, MessageType.AgvFile, pathAgv, false);
        }
Exemple #7
0
        private void OnClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            _log.InfoFormat("TCP client [{0}] has connected.", e.Session.RemoteEndPoint);
            _sessions.Add(e.Session.SessionKey, e.Session);

            if (Connected != null)
            {
                Connected(this, new ActorTransportConnectedEventArgs(e.Session.SessionKey));
            }
        }
        public override void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            string str = string.Format("TCP client {0} has connected.", e.Session.RemoteEndPoint);

            Console.WriteLine(str);
            Logs.Info(str);
            OnMessageEvent(this, new MessageEventArgs(str));
            string pathAgv = ConstDefine.AGV_PATH;

            SendTo(e.Session.SessionKey, MessageType.AgvFile, pathAgv, false);
            //_server.SendTo()
        }
Exemple #9
0
        private void OnClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            _log.DebugFormat("TCP client [{0}] has connected.", e.Session.RemoteEndPoint);
            var session = new ActorTransportSession(e.Session);

            _sessions.Add(e.Session.SessionKey, session);

            if (TransportConnected != null)
            {
                TransportConnected(this, new ActorTransportSessionConnectedEventArgs(session));
            }
        }
Exemple #10
0
        void OnClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            int count = server.SessionCount;

            if (count >= Settings.Default.MaxConnections)
            {
                throw new InvalidOperationException($"The maximum number of connections has been exceeded {count}.");
            }
            else
            {
                if (Settings.Default.DebugMode)
                {
                    Log(string.Format("TCP client {0} has connected {1}.", e.Session.RemoteEndPoint, e.Session.LocalEndPoint));
                }
            }
        }
Exemple #11
0
 public abstract void server_ClientConnected(object sender, TcpClientConnectedEventArgs e);
Exemple #12
0
 static void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Debug.Log(string.Format("TCP client {0} has connected.",
                             e.TcpClient.Client.RemoteEndPoint.ToString()));
 }
 private void _server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Console.WriteLine(string.Format("{0}ClientConnected", e.Session.SessionKey));
 }
Exemple #14
0
 /// <summary>
 /// 客户端连接事件执行
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">客户端连接事件参数-Tcpclient</param>
 static void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Console.WriteLine("TCP client {0} has connected.", e.TcpClient.Client.RemoteEndPoint.ToString());
 }
Exemple #15
0
 /// <summary>
 /// 显示当期某个客户端已连接
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     LogHelper.showLog(txtLog, "主机:" + e.TcpClient.Client.RemoteEndPoint.ToString() + ",连接到服务器\r\n");
     //LogHelper.WriteLog(DateTime.Now.ToString("HH:mm:ss") + ":" + e.TcpClient.Client.RemoteEndPoint.ToString() + ",连接到服务器\r\n");
 }
 private void OnClientConnected(object sender, TcpClientConnectedEventArgs args)
 {
     _clienTcpConnector = new TcpConnector(args.ClientSocket, new DefaultWireProtocol());
     _clienTcpConnector.MessageReceived += OnMessageReceived;
     _clienTcpConnector.StartAsync();
 }
Exemple #17
0
 private void TcpServer_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     context.Logger.WriteLog("{0}已连接!", e.TcpClient.Client.RemoteEndPoint);
 }
Exemple #18
0
 void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     this.BeginInvoke(new MethodInvoker(delegate
     {
         this.listBox1.Items.Add("Server Thread=" + Thread.CurrentThread.ManagedThreadId + " ==> Accept " + e.remoteEndPoint);
         this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1;
     }));
     //throw new NotImplementedException();
 }
Exemple #19
0
 private void OnClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     _clients.AddOrUpdate(e.TcpClient.Client.RemoteEndPoint.ToString(), e.TcpClient, (n, o) => { return(e.TcpClient); });
 }
Exemple #20
0
 private void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Logger($" {e.TcpClient.Client.RemoteEndPoint} Connect");
 }
 private static void Server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Console.WriteLine($"client [{e.TcpClient.Client.RemoteEndPoint.ToString()}] connected");
 }
Exemple #22
0
 static void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Console.WriteLine(string.Format("TCP client {0} has connected {1}.", e.Session.RemoteEndPoint, e.Session));
 }
Exemple #23
0
        /// <summary>
        /// 客户端连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void server_OnClientConnected(object sender, TcpClientConnectedEventArgs e)
        {
            SocketListener s = sender as SocketListener;

            Console.WriteLine("{0:M} {1:t}:有新的连接,当前连接数{2},终结点:{3}", DateTime.Now, DateTime.Now, s.NumConnections, e.Uid);
        }
Exemple #24
0
 static void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Console.WriteLine(string.Format("TCP client {0} has connected {1}.", e.Session.RemoteEndPoint, e.Session));
 }
Exemple #25
0
 static void server_ClientConnected(object sender, TcpClientConnectedEventArgs e)
 {
     Logger.Debug(string.Format(CultureInfo.InvariantCulture, "TCP client {0} has connected.", e.TcpClient.Client.RemoteEndPoint.ToString()));
 }