Пример #1
0
 /// <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();
 }
Пример #2
0
        /// <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();
        }