示例#1
0
        public ServerSession(string host, int port, ProxyClient client)
        {
            this.commandTable = new Dictionary<ushort, Packet>();

            this.commandTable.Add(0xFFFF, new Packets.Server.SendUniversal());

            this.Client = client;

            Socket newSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this.sock = newSock;
            this.host = host;
            this.port = port;
            this.Connect();
        }
示例#2
0
 /// <summary>
 /// Connects new clients
 /// </summary>
 public override void NetworkLoop(int maxNewConnections)
 {
     for (int i = 0; listener.Pending() && i < maxNewConnections; i++)
     {
         Socket sock = listener.AcceptSocket();
         string ip = sock.RemoteEndPoint.ToString().Substring(0, sock.RemoteEndPoint.ToString().IndexOf(':'));
         Logger.ShowInfo("New client from: " + sock.RemoteEndPoint.ToString(), null);
         ProxyClient client = new ProxyClient(sock, this.commandTable, this.IP, port, this.packetContainerClient, this.packetContainerServer, this.packets, this.firstlvlen);
         clients.Add(client);
     }
 }