public TcpClientPool(ITcpClientFactory factory)
        {
            Factory = factory;
#if SUPPORTS_NLOG
            _logger.Trace("Created TcpClientPool");
#endif
        }
 public Client(ITcpClientFactory tcpClientFactory, SocksAddress address, SocksAddress destinationAddress, bool useSsl)
 {
     _destinationAddress = destinationAddress;
     _useSsl             = useSsl;
     _tcpClientFactory   = tcpClientFactory;
     _address            = address;
 }
 public TaskController(ITaskService taskservice, ILineService lineService, ITcpClientFactory tcpClientFactory, ITerminalService terminalService)
 {
     this.currentservice   = taskservice;
     this.lineService      = lineService;
     this.tcpClientFactory = tcpClientFactory;
     this.terminalService  = terminalService;
 }
Exemple #4
0
 public SendJt808MessageController(ITcpClientFactory tcpClientFactory, ITcpClientManager tcpClientManager, ITerminalService terminalService, ILogger <SendJt808MessageController> logger)
 {
     this.tcpClientFactory = tcpClientFactory;
     this.tcpClientManager = tcpClientManager;
     this.terminalService  = terminalService;
     this.logger           = logger;
 }
Exemple #5
0
    public TcpServer(ILogger logger, ITcpClientFactory tcpClientFactory)
    {
        this.logger           = logger;
        this.tcpClientFactory = tcpClientFactory;

        cancellationTokenSource = new CancellationTokenSource();
    }
        /// <summary>
        ///     Initializes a new instance of the <see cref="T:System.Object" /> class.
        /// </summary>
        public TcpMessageListener(ITcpClientFactory tcpClientFactory,
            IMessageDeserializerFactory messageDeserializerFactory, MessageEventDispatcher messageDispatcher)
        {
            _tcpClientFactory = tcpClientFactory;
            _messageDeserializerFactory = messageDeserializerFactory;
            _messageDispatcher = messageDispatcher;

            _clientThread = new Thread(ClientThread) {IsBackground = true};
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the Connection class.
        /// </summary>
        internal Connection(ITcpClientFactory tcpClientFactory)
        {
            ConnectTimeout = DefaultTimeoutLength;

            _tcpClientFactory = tcpClientFactory;
            _lockedStream     = new LockedResource <INetworkStream>();
            _tcpClient        = CreateClient();
            _internalBuffer   = new byte[InternalBufferSize];
            _readBuffer       = new StringBuilder();
        }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of the Connection class.
        /// </summary>
        internal Connection(ITcpClientFactory tcpClientFactory)
        {
            ConnectTimeout = DefaultTimeoutLength;

            _tcpClientFactory = tcpClientFactory;
            _tcpClient        = CreateClient();
            _internalBuffer   = new byte[InternalBufferSize];
            _readBuffer       = new StringBuilder();
            _timer            = new Timer(DefaultSocketTimerLength);
            _timer.Elapsed   += SocketTimerElapsed;
            _timer.AutoReset  = false;
        }
Exemple #9
0
        public TcpProxy(ILogger <TcpProxy> logger, ReverseProxyConfiguration configuration, ITcpClientFactory tcpClientFactory)
        {
            _logger           = logger;
            _configuration    = configuration;
            _tcpClientFactory = tcpClientFactory;
            var serializer   = new Serializer(new[] { typeof(FailcPacket) });
            var packetString = serializer.Serialize(new FailcPacket
            {
                Type = LoginFailType.Maintenance
            });

            _packet = Encoding.Default.GetBytes($"{packetString} ");
            for (var i = 0; i < packetString.Length; i++)
            {
                _packet[i] = Convert.ToByte(_packet[i] + 15);
            }

            _packet[^ 1] = 25;
 public Socks5HttpClientFactory(ITcpClientFactory tcpClientFactory)
 {
     _pool             = new Pooling.TcpClientPool(tcpClientFactory);
     _tcpClientFactory = tcpClientFactory;
 }
Exemple #11
0
        /// <summary>
        /// Initializes a new instance of the Connection class.
        /// </summary>
        internal Connection(ITcpClientFactory tcpClientFactory)
        {
            ConnectTimeout = DefaultTimeoutLength;

             _tcpClientFactory = tcpClientFactory;
             _tcpClient = CreateClient();
             _internalBuffer = new byte[InternalBufferSize];
             _readBuffer = new StringBuilder();
             _timer = new Timer(DefaultSocketTimerLength);
             _timer.Elapsed += SocketTimerElapsed;
        }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the MessageCache class.
 /// </summary>
 internal MessageCache(ITcpClientFactory tcpClientFactory)
     : base(tcpClientFactory)
 {
     //_readBuffer = new StringBuilder();
     _messages = new Dictionary <string, JsonMessage>();
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the MessageCache class.
 /// </summary>
 internal MessageCache(ITcpClientFactory tcpClientFactory)
     : base(tcpClientFactory)
 {
     //_readBuffer = new StringBuilder();
      _messages = new Dictionary<string, JsonMessage>();
 }
Exemple #14
0
      /// <summary>
      /// Initializes a new instance of the Connection class.
      /// </summary>
      internal Connection(ITcpClientFactory tcpClientFactory)
      {
         ConnectTimeout = DefaultTimeoutLength;

         _tcpClientFactory = tcpClientFactory;
         _lockedStream = new LockedResource<INetworkStream>();
         _tcpClient = CreateClient();
         _internalBuffer = new byte[InternalBufferSize];
         _readBuffer = new StringBuilder();
      }
 public TcpClientWrapperMessageHandler(ITcpClientFactory factory)
     : this(new Pooling.TcpClientPool(factory))
 {
 }
 public TcpClientWrapper(SocksAddress destinationAddress, bool useSsl, ITcpClientFactory factory)
 {
     _destinationAddress = destinationAddress;
     _useSsl             = useSsl;
     _factory            = factory;
 }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the FahClient class.
 /// </summary>
 internal FahClient(ITcpClientFactory tcpClientFactory)
     : base(tcpClientFactory)
 {
 }
Exemple #18
0
 public HttpSocks4MessageHandler(ITcpClientFactory tcpClientFactory, ISocksWebProxy proxy)
 {
     _pool = new Pooling.TcpClientPool(tcpClientFactory);
     Proxy = proxy;
 }
Exemple #19
0
 public BranchTcpServerHandler(ILogger <BranchTcpServerHandler> logger, IServerSessionManager serverSessionManager, ITcpClientFactory tcpClientFactory, ITcpClientManager tcpClientManager, IOptions <GatewayConfiguration> options)
 {
     this.logger               = logger;
     this.tcpClientManager     = tcpClientManager;
     this.serverSessionManager = serverSessionManager;
     configuration             = options.Value;
     Parallel.ForEach(configuration.BrabchServer, x =>
     {
         tcpClientFactory.CreateTcpClient(x.IpAdress);
     });
 }