예제 #1
0
    private void NetworkStart()
    {
        try
        {
            //开启服务器
            Handlers = new ClientHandler();
            Handlers.AutoLoad();

            NetworkListener = new TcpListener(new System.Net.IPEndPoint(0, port));
            NetworkListener.Start();
            Log.Info(string.Format("tcp 端口:{0}", port));
            NetworkListener.BeginAcceptTcpClient(new AsyncCallback(BeginAcceptTcpClient), (object)null);
        }
        catch (Exception ex)
        {
            Log.Error("NetworkStart:" + ex);
        }
    }