Exemple #1
0
        public InProcSocket Connect(RedFoxEndpoint endpoint)
        {
            if (endpoint.Transport != RedFoxTransport.Inproc)
            {
                throw new ArgumentException("Only InProcess transport endpoints are allowed to be registered");
            }

            BlockingCollection <InProcSocketPair> accepter;

            if (!_registeredAccepterPorts.TryGetValue(endpoint, out accepter))
            {
                throw new InvalidOperationException("Endpoint not listening to InProcess clients");
            }

            var clientStream = new BlockingConcurrentQueue <MessageFrame>();
            var serverStream = new BlockingConcurrentQueue <MessageFrame>();
            var clientSocket = new InProcSocket(endpoint, clientStream, serverStream);
            var serverSocket = new InProcSocket(endpoint, serverStream, clientStream);

            var socketPair = new InProcSocketPair(clientSocket, serverSocket);

            accepter.Add(socketPair);

            return(clientSocket);
        }
        public InProcSocket Connect(RedFoxEndpoint endpoint)
        {
            if (endpoint.Transport != RedFoxTransport.Inproc)
                throw new ArgumentException("Only InProcess transport endpoints are allowed to be registered");

            BlockingCollection<InProcSocketPair> accepter;
            if (!_registeredAccepterPorts.TryGetValue(endpoint, out accepter))
            {
                throw new InvalidOperationException("Endpoint not listening to InProcess clients");
            }

            var clientStream = new BlockingConcurrentQueue<MessageFrame>();
            var serverStream = new BlockingConcurrentQueue<MessageFrame>();
            var clientSocket = new InProcSocket(endpoint, clientStream, serverStream);
            var serverSocket = new InProcSocket(endpoint, serverStream, clientStream);

            var socketPair = new InProcSocketPair(clientSocket, serverSocket);
            accepter.Add(socketPair);

            return clientSocket;
        }