コード例 #1
0
        public Server(string ip, int port, IClientDataReceiver receiver, IServerConnector connector, ILogger logger)
        {
            this.isReady   = IPAddress.TryParse(ip, out this.host);
            this.isRunning = false;

            this.port      = port;
            this.receiver  = receiver;
            this.connector = connector;
            this.logger    = logger;

            this.connections = new List <ClientConnection>();
        }
コード例 #2
0
        public ClientConnection(TcpClient client, Server server, IClientDataReceiver receiver = null, ILogger logger = null)
        {
            this.isConnected = false;

            this.client = client;
            this.stream = this.client.GetStream();

            this.receiver = receiver;
            this.logger   = logger;
            this.server   = server;
            this.Id       = HashUtil.HashMD5(GetIp() + GetPort());

            InitilizeListenerThread();
        }