Пример #1
0
 protected IPConnection(
     IConnectionManager manager,
     Endpoint endpoint,
     ITransceiver transceiver,
     BinaryConnection connection,
     IConnector?connector,
     string connectionId,
     ObjectAdapter?adapter)
     : base(manager, endpoint, connection, connector, connectionId, adapter) => _transceiver = transceiver;
Пример #2
0
        private void ListenerStart()
        {
            _listeningException = null;
            bool transportIsOk = true;

            try
            {
                // make transport to listen for the client connections
                _transportListener.Start((int)SocketOptionName.MaxConnections);
            }
            catch (Exception ex)
            {
                _listeningException = ex;
                transportIsOk       = false;
            }
            finally
            {
                // signal to main thread that listener started
                _listenerStartedSignal.Set();
            }

            while (transportIsOk)
            {
                try
                {
                    // wait for the client connection
                    BinaryConnection connection = new BinaryConnection(this, _transportListener.AcceptClient());

                    // serve requests on this connection
                    RequestQueue.DefaultQueue.AddConnection(connection, _requestHandler);
                }
                catch (Exception ex)
                {
                    if (!_isListening)
                    {
                        // listener was stopped
                        transportIsOk = false;
                    }
                    else
                    {
                        // store exception for diagnostics usage
                        _listeningException = ex;
                    }
                }
            }
        }
Пример #3
0
		private void ListenerStart()
		{
			_listeningException = null;
			bool transportIsOk = true;

			try
			{
				// make transport to listen for the client connections
				_transportListener.Start((int)SocketOptionName.MaxConnections);
			}
			catch (Exception ex)
			{
				_listeningException = ex;
				transportIsOk = false;
			}
			finally
			{
				// signal to main thread that listener started
				_listenerStartedSignal.Set();
			}

			while (transportIsOk)
			{
				try
				{
					// wait for the client connection
					BinaryConnection connection = new BinaryConnection(this, _transportListener.AcceptClient());

					// serve requests on this connection
					RequestQueue.DefaultQueue.AddConnection(connection, _requestHandler);
				}
				catch (Exception ex)
				{
					if (!_isListening)
					{
						// listener was stopped
						transportIsOk = false;
					}
					else
					{
						// store exception for diagnostics usage
						_listeningException = ex;
					}
				}
			}
		}