Beispiel #1
0
        public void OnConnection(IAsyncResult res)
        {
            Socket client = null;

            try {
                client = _listener.EndAccept(res);
                if (_connectHandler != null)
                {
                    _connectHandler(this, new ConnectEventArgs(client.RemoteEndPoint));
                }
            } catch (SocketException ex) {
                if (log.IsDebugEnabled)
                {
                    log.Debug("Socket exception", ex);
                }
                return;
            } catch (ObjectDisposedException) {
                return;
            }
            PolicyConnection pc = new PolicyConnection(this, client, _policy);

            _listener.BeginAccept(new AsyncCallback(OnConnection), null);
        }
Beispiel #2
0
		public void OnConnection(IAsyncResult res) {
			Socket client = null;
			try {
				client = _listener.EndAccept(res);
				if (_connectHandler != null)
					_connectHandler(this, new ConnectEventArgs(client.RemoteEndPoint));
			} catch (SocketException ex) {
				if (log.IsDebugEnabled)
					log.Debug("Socket exception", ex);
				return;
			} catch (ObjectDisposedException) {
				return;
			}
			PolicyConnection pc = new PolicyConnection(this, client, _policy);
			_listener.BeginAccept(new AsyncCallback(OnConnection), null);
		}