Example #1
0
        private void Accept()
        {
            this.m_acceptedSocket = new PgmSocket(this.m_options, PgmSocketType.Receiver, this.m_address);
            this.m_acceptedSocket.Init();

            this.m_handle.Accept(this.m_acceptedSocket.Handle);
        }
Example #2
0
        public PgmSession([NotNull] PgmSocket pgmSocket, [NotNull] Options options)
        {
            this.m_handle  = pgmSocket.Handle;
            this.m_options = options;
            this.m_data    = new byte[Config.PgmMaxTPDU];
            this.m_joined  = false;

            this.m_state = State.Idle;
        }
Example #3
0
        public void Init([NotNull] PgmAddress pgmAddress)
        {
            this.m_pgmAddress = pgmAddress;

            this.m_pgmSocket = new PgmSocket(this.m_options, PgmSocketType.Publisher, (PgmAddress)this.m_addr.Resolved);
            this.m_pgmSocket.Init();

            this.m_socket = this.m_pgmSocket.Handle;

            IPEndPoint localEndpoint = new IPEndPoint(IPAddress.Any, 0);

            this.m_socket.Bind(localEndpoint);

            this.m_pgmSocket.InitOptions();

            this.m_outBufferSize = this.m_options.PgmMaxTransportServiceDataUnitLength;
            this.m_outBuffer     = new ByteArraySegment(new byte[this.m_outBufferSize]);
        }
Example #4
0
        /// <exception cref="InvalidException">Unable to parse the address's port number, or the IP address could not be parsed.</exception>
        /// <exception cref="NetMQException">Error establishing underlying socket.</exception>
        public void Init([NotNull] string network)
        {
            this.m_address = new PgmAddress(network);

            this.m_pgmSocket = new PgmSocket(this.m_options, PgmSocketType.Listener, this.m_address);
            this.m_pgmSocket.Init();

            this.m_handle = this.m_pgmSocket.Handle;

            try
            {
                this.m_handle.Bind(this.m_address.Address);
                this.m_pgmSocket.InitOptions();
                this.m_handle.Listen(this.m_options.Backlog);
            }
            catch (SocketException ex)
            {
                this.Close();

                throw NetMQException.Create(ex);
            }

            this.m_socket.EventListening(this.m_address.ToString(), this.m_handle);
        }