/// <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); } }
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(); }
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(); }