/// <summary> /// Initializes a new instance of the <see cref="TcpServer" /> class. /// </summary> /// <param name="port">The port.</param> /// <param name="loggingService">The logging service.</param> /// <param name="clientHandlerFactory">The client handler factory.</param> public TcpServer(int port, ILoggingService loggingService, IClientHandlerFactory clientHandlerFactory) { _clientHandlerFactory = clientHandlerFactory; _port = port; _loggingService = loggingService; _clientHandlersList = new List <ITcpClientHandler>(); Start(); }
public NewsBlurClient(IClientHandlerFactory handlerFactory, ILogger logger, string userAgent = "NewsBlurSharp") { _handlerFactory = handlerFactory; _userAgent = userAgent; _handler = GetHandlerFromFactory(handlerFactory); _httpClient = CreateHttpClient(); _logger = logger ?? new NullLogger(); }
public RpcServer(IPEndPoint listenEndpoint, IClientHandlerFactory clientHandlerFactory) { _listenEndpoint = listenEndpoint; _clientHandlerFactory = clientHandlerFactory; _listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _listenSocket.Bind(_listenEndpoint); _listenSocket.Listen(10); _log.InfoFormat("Created server on {0} with handler {1}", listenEndpoint, clientHandlerFactory); BeginWaitForConnection(); }
/// <summary> /// Initialize a new server /// </summary> /// <param name="addr">IP address of TCP listener</param> /// <param name="port">port number of TCP listener</param> /// <param name="serverActions">Instance of server actions class</param> /// <param name="clientHandler">Instance of client handler class</param> public Server(IPAddress addr, int port, IClientHandlerFactory clientHandlerFacotry, IServerActions serverActions = null) { this.Address = addr; this.Port = port; this.clientHandlerFactory = clientHandlerFacotry; this.serverActions = serverActions; this.listener = new TcpListener(Address, Port); clients = new Dictionary<string, TcpClient>(); }
public ClacksServer(IPEndPoint listenEndpoint, IClacksInstrumentation instrumentation, IClientHandlerFactory clientHandlerFactory) { _listenEndpoint = listenEndpoint; _instrumentation = instrumentation; _clientHandlerFactory = clientHandlerFactory; _listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; _listenSocket.Bind(_listenEndpoint); _listenSocket.Listen((int) SocketOptionName.MaxConnections); _log.InfoFormat("Created server on {0} with handler {1}", listenEndpoint, clientHandlerFactory); BeginWaitForConnection(); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultClientConnector"/> class. /// </summary> /// <param name="clientLookup"> /// The client lookup. /// </param> /// <param name="clientHandlerFactory"> /// The client handler factory. /// </param> /// <param name="messageConstructor"> /// The message constructor. /// </param> /// <param name="messageSideChannel"> /// The message side channel. /// </param> public DefaultClientConnector( IClientLookup clientLookup, IClientHandlerFactory clientHandlerFactory, IMessageConstructor messageConstructor, IMessageSideChannel messageSideChannel) { this.m_ClientLookup = clientLookup; this.m_ClientHandlerFactory = clientHandlerFactory; this.m_MessageConstructor = messageConstructor; this.m_MessageSideChannel = messageSideChannel; }
private HttpClientHandler GetHandlerFromFactory(IClientHandlerFactory handlerFactory) { var handler = handlerFactory?.CreateHandler() as HttpClientHandler ?? new HttpClientHandler(); SetCookieSessionId(_cookieSessionId); handler.CookieContainer = _cookieJar; handler.UseCookies = true; handler.UseDefaultCredentials = false; return(handler); }
public DefaultConnectionHandler(IClientHandlerFactory clientHandlerFactory, IClientLookup clientLookup) { this.m_ClientHandlerFactory = clientHandlerFactory; this.m_ClientLookup = clientLookup; }
/// <summary> /// Initialize a new server /// </summary> /// <param name="port">port number of TCP listener</param> /// <param name="serverActions">Instance of server actions class</param> /// <param name="clientHandler">Instance of client handler class</param> public Server(int port, IClientHandlerFactory clientHandlerFacotry, IServerActions serverActions = null) : this(IPAddress.Loopback, port, clientHandlerFacotry, serverActions) { }
private ServerBuilder(IPEndPoint endPoint, bool isAsync) { _endPoint = endPoint; _clientHandlerFactory = isAsync ? (IClientHandlerFactory)new AsyncClientHandlerFactory(_asyncRepository) : new SyncClientHandlerFactory(_syncRepository); }
public NewsBlurClient(IClientHandlerFactory handlerFactory) : this(handlerFactory, new NullLogger()) { }