Esempio n. 1
0
 public TcpPeerFactory(NetworkConfig config, ILogger <TcpPeerFactory> logger, ILogger <TcpPeer> peerLogger)
 {
     _forceIPv6  = config.ForceIPv6;
     _logger     = logger;
     _peerLogger = peerLogger;
     _protocols  = new TcpProtocolSelector();
 }
Esempio n. 2
0
        public TcpPeer(Socket socket, TcpProtocolSelector protocolSelector, ILogger <TcpPeer> logger)
        {
            _socket           = socket ?? throw new ArgumentNullException(nameof(socket));
            _protocolSelector = protocolSelector ?? throw new ArgumentNullException(nameof(protocolSelector));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));

            _stream   = new NetworkStream(socket, true);
            _protocol = protocolSelector.DefaultProtocol;
        }