Example #1
0
        /// <summary>
        /// Initialize a new nanomsg socket for the given domain and protocol
        /// </summary>
        /// <exception cref="NNanomsg.NanomsgException">Thrown if a socket can't be created for this domain and protocol</exception>
        public NanomsgSocketBase(Domain domain, Protocol protocol)
        {
            Domain   = domain;
            Protocol = protocol;

            _socket = Interop.nn_socket((int)Domain, (int)Protocol);
            if (_socket >= 0)
            {
                Options = new NanomsgSocketOptions(_socket);
            }
            else
            {
                throw new NanomsgException(string.Format("nn_socket {0} {1}", domain, protocol));
            }
        }
Example #2
0
 public static int Socket(Domain domain, Protocol protocol)
 {
     return(Interop.nn_socket((int)domain, (int)protocol));
 }