/// <summary> /// Creates a new connection manager of thisitem /// </summary> /// <param name="ip">The ip to connect to</param> /// <param name="port">The port that should be contacted</param> public ClientConnectionManager(string ip, int port) { this.ip = ip; this.port = port; connection = new ClientSocketInformation(ip, port, true); connection.connectionChanged += reportNewConnectionState; connection.packetArrival += packetArrival; processor = new PacketProcessor(); }
public ASyncMainServerConnection(string ip, int port, string licenseID, int slots) { this.notInDemoMode = true; this.RSAService = new RSAHandler(); this.ClientModule = new ClientSocketInformation(ip, port, true); this.ClientModule.connectionChanged += ClientModule_connectionChanged; this.ClientModule.packetArrival += OnNewPacket; this.licenseID = licenseID; this.Slots = Slots; monitorThread = new Thread(CheckLoop); monitorThread.Start(); }
/// <summary> /// Resets the connection and cleans the packet register /// </summary> public void reset() { connection.Dispose(); connection.connectionChanged -= reportNewConnectionState; connection.packetArrival -= packetArrival; connection = new ClientSocketInformation(ip, port, true); connection.connectionChanged += reportNewConnectionState; connection.packetArrival += packetArrival; processor = new PacketProcessor(); }