protected AClientRequestHandler(Guid clientId, Socket socket, IClacksInstrumentation instrumentation, Action<IClientHandler> removeCallback) {
     _clientId = clientId;
     _socket = socket;
     _endPoint = _socket.RemoteEndPoint as IPEndPoint;
     _instrumentation = instrumentation;
     _removeCallback = removeCallback;
     _instrumentation.ClientConnected(_clientId, _endPoint);
 }
 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();
 }
Example #3
0
 public FaultingSyncClientHandler(Guid clientId, Socket socket, ISyncCommandDispatcher dispatcher, IClacksInstrumentation instrumentation, Action<IClientHandler> removeCallback, Func<bool> checkForFault)
     : base(clientId, socket, dispatcher, instrumentation, removeCallback) {
     _checkForFault = checkForFault;
 }
Example #4
0
 public IClientHandler Create(Guid clientId, Socket socket, IClacksInstrumentation instrumentation, Action<IClientHandler> removeHandler) {
     Console.WriteLine("new connection");
     return new FaultingSyncClientHandler(clientId, socket, _dispatcher, instrumentation, removeHandler, CheckForFault);
 }
 public IClientHandler Create(Guid clientId, Socket socket, IClacksInstrumentation instrumentation, Action<IClientHandler> removeHandler) {
     return new SyncClientHandler(clientId, socket, _dispatcher, instrumentation, removeHandler);
 }
 public ClacksServer Build(IClacksInstrumentation instrumentation) {
     return new ClacksServer(_endPoint, instrumentation ?? BaseClacksInstrumentation.Instance, _clientHandlerFactory);
 }
 public SyncClientHandler(Guid clientId, Socket socket, ISyncCommandDispatcher dispatcher, IClacksInstrumentation instrumentation, Action<IClientHandler> removeCallback)
     : base(clientId, socket, instrumentation, removeCallback) {
     _dispatcher = dispatcher;
 }