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);
        }
Exemple #2
0
 public InProcSocket(RedFoxEndpoint endpoint, BlockingConcurrentQueue <MessageFrame> writeStream, BlockingConcurrentQueue <MessageFrame> readStream)
 {
     if (writeStream == null)
     {
         throw new ArgumentNullException("writeStream");
     }
     if (readStream == null)
     {
         throw new ArgumentNullException("readStream");
     }
     Endpoint     = endpoint;
     _writeStream = writeStream;
     _readStream  = readStream;
 }