Пример #1
0
 IServer IIpcProvider.GetServer(string connectionString, IServerConfig config)
 {
     return(new NonMultiplexingServer <Socket>(
                "TcpIpServer",
                config,
                new TcpIpConnectivity(TcpIpConnectivity.ParsePortNumber(connectionString))));
 }
        IServer IIpcProvider.GetServer(string connectionString, IServerConfig config)
        {
            var port = TcpIpConnectivity.ParsePortNumber(connectionString);

            return(new MultiplexingServer <Socket>(
                       "TcpIp-" + port,
                       config.Logger,
                       connectivityProvider: new TcpIpConnectivity(port),
                       maxConcurrentClients: config.MaxConcurrentClients,
                       maxConcurrentRequestsPerClient: config.MaxConcurrentRequestsPerClient));
        }
Пример #3
0
        private PluginCreationArgument GetPluginArgument(string pluginPath, bool runInSeparateProcess)
        {
            var pluginId = PluginFactory.Instance.CreatePluginId();

            return(new PluginCreationArgument()
            {
                PluginPath = pluginPath,
                RunInSeparateProcess = runInSeparateProcess,
                PluginId = pluginId,
                ConnectionOption = new PluginConnectionOption()
                {
                    IpcMoniker = IpcFactory.GetProvider().LoadAndRenderMoniker(IpcFactory.GetProvider().CreateNewMoniker().Id),
                    LogDir = m_logDirectory,
                    Logger = PluginLogUtils.CreateLoggerForPluginClients(m_loggingContext, pluginId)
                },

                CreatePluginClientFunc = options =>
                {
                    int port = TcpIpConnectivity.ParsePortNumber(options.IpcMoniker);
                    return new PluginClient(IPAddress.Loopback.ToString(), port, options.Logger);
                }
            });
        }
 IClient IIpcProvider.GetClient(string connectionString, IClientConfig config)
 {
     return(new Client(config, TcpIpConnectivity.ParsePortNumber(connectionString)));
 }
Пример #5
0
        public void TestParseInvalidPortNumber(string port)
        {
            var ex = Assert.Throws <IpcException>(() => TcpIpConnectivity.ParsePortNumber(port));

            XAssert.AreEqual(IpcException.IpcExceptionKind.InvalidMoniker, ex.Kind);
        }