Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Server" /> class.
        /// </summary>
        protected ServerBase(ServerConfiguration configuration)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");
            configuration.Validate();

            _numConnectedSockets = 0;
            _maxAmountOfConnection = configuration.MaximumNumberOfClients;
            _maxNumberAcceptedClients = new Semaphore(configuration.MaximumNumberOfClients,
                                                      configuration.MaximumNumberOfClients);

            // *2 since we need one for each send/receive pair.
            _bufferSliceStack = new BufferSliceStack(configuration.MaximumNumberOfClients*2, configuration.BufferSize);
        }
 public MyServer(ServerConfiguration configuration, Func<INetworkService> factory) : base(configuration)
 {
     _factory = factory;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Server" /> class.
 /// </summary>
 /// <param name="clientFactory">The client factory.</param>
 /// <param name="configuration">The configuration.</param>
 /// <exception cref="System.ArgumentNullException">clientFactory</exception>
 public Server(IServiceFactory clientFactory, ServerConfiguration configuration) : base(configuration)
 {
     if (clientFactory == null) throw new ArgumentNullException("clientFactory");
     if (configuration == null) throw new ArgumentNullException("configuration");
     _clientFactory = clientFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PipelineServer" /> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public PipelineServer(IPipelineFactory factory, ServerConfiguration configuration) : base(configuration)
 {
     _factory = factory;
     _configuration = configuration;
 }