CreateSocket() private method

private CreateSocket ( ZmqSocketType socketType ) : NetMQSocket
socketType ZmqSocketType
return NetMQSocket
Ejemplo n.º 1
0
        /// <summary>
        /// Starts the publishing and request servers.
        /// </summary>
        public void StartServer()
        {
            if (!ServerRunning)
            {
                _context = NetMQContext.Create();

                //the publisher socket
                _pubSocket = _context.CreatePublisherSocket();
                _pubSocket.Bind("tcp://*:" + PublisherPort);

                //the request socket
                _reqSocket = _context.CreateSocket(ZmqSocketType.Rep);
                _reqSocket.Bind("tcp://*:" + RequestPort);
                _reqSocket.ReceiveReady += _reqSocket_ReceiveReady;

                _poller = new Poller(new[] { _reqSocket });
                Task.Factory.StartNew(_poller.Start, TaskCreationOptions.LongRunning);
            }
            ServerRunning = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        public void StartServer()
        {
            if (_runServer) return;

            _runServer = true;
            _context = NetMQContext.Create();

            _socket = _context.CreateSocket(NetMQ.zmq.ZmqSocketType.Rep);
            _socket.Bind("tcp://*:" + _socketPort);
            _socket.ReceiveReady += _socket_ReceiveReady;
            _poller = new Poller(new[] { _socket });

            Task.Factory.StartNew(_poller.Start, TaskCreationOptions.LongRunning);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Start the server.
        /// </summary>
        public void StartServer()
        {
            //check that it's not already running
            if (ServerRunning) return;
            _context = NetMQContext.Create();

            _routerSocket = _context.CreateSocket(NetMQ.zmq.ZmqSocketType.Router);
            _routerSocket.Bind("tcp://*:" + _listenPort);
            _routerSocket.ReceiveReady += socket_ReceiveReady;

            _poller = new Poller(new[] { _routerSocket });

            Task.Factory.StartNew(_poller.Start, TaskCreationOptions.LongRunning);

            ServerRunning = true;
        }