示例#1
0
 /// <summary>
 /// Instantiates a new <see cref="BasicServerBase"/>.
 /// </summary>
 /// <param name="channelAddress">The client's address.</param>
 /// <param name="configuration">The client's configuration.</param>
 /// <param name="transportController">Controls the transportation layer.</param>
 /// <param name="logSourceId">The value used for the <see cref="Logging.ILogEntry.SourceId"/> when generating <see cref="Logging.ILog"/>s.</param>
 protected BasicServerBase(IChannelAddress channelAddress,
                           IServerConfiguration configuration,
                           ITransportController transportController,
                           string logSourceId)
     : this()
 {
     Initialize(channelAddress, configuration, transportController, logSourceId);
 }
示例#2
0
 /// <summary>
 /// Creates an instance of <b>Actual Client</b>.
 /// </summary>
 /// <param name="clientConfiguration">The client configuration.</param>
 /// <param name="transporterController">The transport layer controller.</param>
 /// <param name="messageChannelAction">The action to execute when a message is received.</param>
 /// <param name="closeClientAction">The action to execute when closing the client.</param>
 /// <param name="restartClientAction">The action to execute when a restart is requested.</param>
 public ClientActual(IClientConfiguration clientConfiguration,
                     ITransportController transporterController,
                     Action <MessageEventArgs> messageChannelAction,
                     Action closeClientAction,
                     Action <int, TimeSpan> restartClientAction)
     : this()
 {
     _ClientConfiguration   = clientConfiguration ?? throw new ArgumentNullException(nameof(clientConfiguration));
     _TransporterController = transporterController ?? throw new ArgumentNullException(nameof(transporterController));
     _MessageChannelAction  = messageChannelAction ?? throw new ArgumentNullException(nameof(messageChannelAction));
     _CloseClientAction     = closeClientAction ?? throw new ArgumentNullException(nameof(closeClientAction));
     _RestartClientAction   = restartClientAction ?? throw new ArgumentNullException(nameof(restartClientAction));
 }
 /// <summary>
 /// Creates a new instance of <b>Actual Server</b>.
 /// </summary>
 /// <param name="serverId">The unique id for this server.</param>
 /// <param name="transportController">Used to control the transportation layer.</param>
 /// <param name="overrideTypesFilter">A collection of <see cref="IPayloadTypeInfo"/> representing the types this server will send to clients regardless of the client's <see cref="IClientConfiguration.ReceivableTypesFilter"/>.</param>
 /// <param name="logSourceId">The value used by the <see cref="ServerBase"/> for the <see cref="Logging.ILogEntry.SourceId"/> when generating <see cref="Logging.ILog"/>s.</param>
 public ServerActual(string serverId,
                     ITransportController transportController,
                     IEnumerable <IPayloadTypeInfo> overrideTypesFilter,
                     string logSourceId)
     : this()
 {
     if (string.IsNullOrWhiteSpace(serverId))
     {
         throw new ArgumentNullException(nameof(serverId));
     }
     _ServerId             = serverId;
     OverrideTypesFilter   = overrideTypesFilter ?? throw new ArgumentNullException(nameof(overrideTypesFilter));
     TransporterController = transportController ?? throw new ArgumentNullException(nameof(transportController));
     if (string.IsNullOrWhiteSpace(logSourceId))
     {
         throw new ArgumentNullException(nameof(logSourceId));
     }
     LogSourceId = logSourceId;
 }
示例#4
0
        /// <summary>
        /// Initializes binding elements.
        /// </summary>
        void Initialize()
        {
            List <IChannelController> transportControllers = new List <IChannelController>();
            List <IChannelController> encoderControllers   = new List <IChannelController>();

            foreach (IChannelController controller in _controllers)
            {
                ITransportController transportController = controller as ITransportController;
                IEncodingController  encodingController  = controller as IEncodingController;

                if (transportController != null)
                {
                    transportControllers.Add(transportController);
                }
                if (encodingController != null)
                {
                    encoderControllers.Add(encodingController);
                }
            }

            _transport = new HttpTransportBindingElement(transportControllers);
            _encoding  = new ControlledTextMessageBindingElement();
            _encoding.AddControllers(encoderControllers);
        }
示例#5
0
 /// <summary>
 /// Instantiates a new <see cref="Server"/>.
 /// </summary>
 /// <param name="channelAddress">The client's address.</param>
 /// <param name="configuration">The client's configuration.</param>
 /// <param name="transportController">Controls the transportation layer.</param>
 /// <param name="logSourceId">The value used for the <see cref="Logging.ILogEntry.SourceId"/> when generating <see cref="Logging.ILog"/>s.</param>
 public Server(IChannelAddress channelAddress,
               IServerConfiguration configuration,
               ITransportController transportController,
               string logSourceId) : base(channelAddress, configuration, transportController, logSourceId)
 {
 }