Esempio n. 1
0
        public void onconnect(IAsyncResult ar)
        {
            if (ar == null)
            {
                return;
            }
            Socket s = _socket.EndAccept(ar);

            s.Send(Encoding.ASCII.GetBytes("hello"));
            connection c = new connection(s, this);

            write("新连接:" + c.ip + ":" + c.port);
            _socket.BeginAccept(new AsyncCallback(onconnect), _socket);
        }
Esempio n. 2
0
 public void onclose(connection c)
 {
     write("连接断开" + c.ip + ":" + c.port);
 }