示例#1
0
        public Server()
        {
            server = this;
            ReadItemSet();
            Socket _server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint _ipep = new IPEndPoint(IPAddress.Any, 50005);
            _server.Bind(_ipep);
            _server.Listen(20);
            Console.WriteLine("Handle of server process: " + _server.Handle.ToInt32());

            SocketAsyncEventArgs _args = new SocketAsyncEventArgs();
            _args.Completed += new EventHandler<SocketAsyncEventArgs>(Accept_Completed);

            _server.AcceptAsync(_args);
            SetTimer();
            DataInput();
        }
示例#2
0
 static void Main(string[] args)
 {
     server = new Server();
 }