Exemple #1
0
        internal static InMemoryServer Start(
            BufferBlock <INetworkClient> waitingClients)
        {
            var server = new InMemoryServer(waitingClients);

            return(server);
        }
        public INetworkServer CreateAndStart(
            IPAddress address,
            int port,
            ProtocolType protocolType)
        {
            var socketId = GetSocketId(address, port, protocolType);
            var clients  = new BufferBlock <INetworkClient>();

            if (_networkServers.TryAdd(
                    socketId, clients) == false)
            {
                throw new InvalidOperationException($"Socket {socketId} has already started");
            }
            return(InMemoryServer.Start(clients));
        }