示例#1
0
        public static void SendBind(Socket destination, Pipe pipe, bool increaseSequenceNumber)
        {
            if(increaseSequenceNumber)
                destination.IncreaseSequenceNumber();

            var command = new BindCommand(destination, pipe);
            SendCommand(command);
        }
示例#2
0
文件: Socket.cs 项目: somdoron/NetMQ4
 internal override void Process(BindCommand command)
 {
     AttachPipe(command.Pipe);
     base.Process(command);
 }
示例#3
0
 internal virtual void Process(BindCommand command)
 {
     throw new NotImplementedException();
 }
示例#4
0
        private static void ConnectInprocSockets(Socket boundSocket, PendingConnection connection)
        {
            boundSocket.IncreaseSequenceNumber();
            connection.BindPipe.SlotId = boundSocket.SlotId;

            // If bound socket doesn't receive identity we need to read from the pipe as we already
            // insert the message while creating the pipe pair
            if (!boundSocket.Options.ReceiveIdentity)
            {
                Frame frame;
                connection.BindPipe.TryRead(out frame);
                frame.Close();
            }

            int inHighWatermark = 0;
            int outHighWatermark = 0;

            if (boundSocket.Options.SendHighWatermark != 0 &&
                connection.Socket.Options.ReceiveHighwatermark != 0)
                inHighWatermark =
                    boundSocket.Options.SendHighWatermark + connection.Socket.Options.ReceiveHighwatermark;

            if (boundSocket.Options.ReceiveHighwatermark != 0 &&
                connection.Socket.Options.SendHighWatermark != 0)
                outHighWatermark =
                    boundSocket.Options.ReceiveHighwatermark + connection.Socket.Options.SendHighWatermark;

            // Set the highwatermarks now as before the bound highwater marks was missing
            connection.ConnectPipe.SetHighWatermarks(inHighWatermark,outHighWatermark);
            connection.BindPipe.SetHighWatermarks(outHighWatermark, inHighWatermark);

            BindCommand bindCommand = new BindCommand(boundSocket, connection.BindPipe);
            boundSocket.Process(bindCommand);

            CommandDispatcher.SendInprocConnected(connection.Socket);

            if (connection.Socket.Options.ReceiveIdentity)
            {
                Frame identity = new Frame();
                identity.Identity = true;
                connection.BindPipe.TryWrite(ref identity);
                connection.BindPipe.Flush();
            }
        }