Пример #1
0
        public EthGateway(string host, int port, OpenSocketType socketType)
        {
            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException("host");
            }

            if (port < 0)
            {
                throw new ArgumentOutOfRangeException("port");
            }

            this.host         = host;
            this.port         = port;
            this.socketType   = socketType;
            this.status       = Status.Disconnected;
            this.buffer       = new byte[bufferSize];
            this.bufferString = String.Empty;
            this.dataToSend   = string.Empty;
            this.onDataReady  = new AsyncCallback(OnDataReady);
            this.onSendData   = new AsyncCallback(OnSendData);
        }
Пример #2
0
        public EthGateway(string host, int port, OpenSocketType socketType)
        {
            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException("host");
            }

            if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
            {
                throw new ArgumentOutOfRangeException("port");
            }

            this.host              = host;
            this.port              = port;
            this.socketType        = socketType;
            this.status            = Status.Disconnected;
            this.buffer            = new byte[bufferSize];
            this.bufferString      = String.Empty;
            this.dataToSend        = string.Empty;
            this.onDataReady       = new AsyncCallback(OnDataReady);
            this.onSendData        = new AsyncCallback(OnSendData);
            this.ackTimer          = new Timer(15000);
            this.ackTimer.Elapsed += new ElapsedEventHandler(ackTimer_Elapsed);
        }