Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverEndPoint"></param>
        /// <param name="setting"></param>
        /// <param name="remoteProtocol"></param>
        public ClientRequestHadler(EndPoint serverEndPoint, SocketSetting setting, IRemoteProtocol remoteProtocol)
        {
            this.remoteProtocol = remoteProtocol;
            if (this.remoteProtocol == null)
            {
                throw new ArgumentNullException("remoteProtocol", "remoteProtocol is null");
            }

            this.all    = new ConcurrentDictionary <ulong, CurrentRequestTaskCompletion>();
            this.client = new ClientSocket(setting, new SocketBufferProvider(setting), serverEndPoint);
            this.client.OnMessageReceived    += Client_OnMessageReceived;
            this.client.OnConnectionAccepted += (s, e) => { this.OnConnectionAccepted?.Invoke(s, e); };
            this.client.OnConnectionClosed   += (s, e) => { this.OnConnectionClosed?.Invoke(s, e); };
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="listeningEndPoint"></param>
        /// <param name="setting"></param>
        /// <param name="responseHandler"></param>
        /// <param name="remoteProtocol"></param>
        public ServerRequestHandler(EndPoint listeningEndPoint, IResponseHandler responseHandler, SocketSetting setting, IRemoteProtocol remoteProtocol)
        {
            this.remoteProtocol = remoteProtocol;
            if (this.remoteProtocol == null)
            {
                throw new ArgumentNullException("remoteProtocol", "remoteProtocol is null");
            }

            this.service = new ServerSocket(setting, new SocketBufferProvider(setting), listeningEndPoint);
            this.service.OnMessageReceived    += Service_OnMessageReceived;
            this.service.OnConnectionAccepted += (s, e) => { this.OnConnectionAccepted?.Invoke(s, e); };
            this.service.OnConnectionClosed   += (s, e) => { this.OnConnectionClosed?.Invoke(s, e); };
            this.ResponseHandler = responseHandler;
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="serverEndPoint"></param>
 /// <param name="remoteProtocol"></param>
 public ClientRequestHadler(EndPoint serverEndPoint, IRemoteProtocol remoteProtocol) : this(serverEndPoint, new SocketSetting(), remoteProtocol)
 {
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="listeningEndPoint"></param>
 /// <param name="responseHandler"></param>
 /// <param name="Protocol"></param>
 public ServerRequestHandler(EndPoint listeningEndPoint, IResponseHandler responseHandler, IRemoteProtocol Protocol) : this(listeningEndPoint, responseHandler, new SocketSetting(), Protocol)
 {
 }