Example #1
0
File: main.cs Project: hkiaipc/guye
        //新建连接  --可能有多个设备共用一个rs
        private void _server_NewConnectEvent(object sender, EventArgs e)
        {
            ISocketRS rs = new SocketRSAPM(this._server.NewSocket);
            string ip = ((IPEndPoint)rs.Socket.RemoteEndPoint).Address.ToString();
            for (int i = 0; i < _ISocketRSlist.Length; i++)
            {
                if (_ISocketRSlist[i]._ip == ip)
                {
                    _ISocketRSlist[i]._rs = rs;
                    _ISocketRSlist[i]._Iscon = true;
                    _ISocketRSlist[i]._Isbusy = false;

                    this._socketRSs.Add(rs);
                    rs.ReceivedEvent += new EventHandler(rs_ReceivedEvent);
                    rs.ClosedEvent += new EventHandler(rs_ClosedEvent);
                    break;
                }
            }
        }
Example #2
0
 void _server_NewConnectEvent(object sender, EventArgs e)
 {
     ISocketRS rs = new SocketRSAPM(this._server.NewSocket);
     AddISocketRS(rs);
     // refresh connected socket list
     //
     byte[] buff = ASCIIEncoding.ASCII.GetBytes(DateTime.Now.ToString());
     rs.Send(buff);
 }