Ejemplo n.º 1
0
        /// <summary>
        /// Connects the socket to the remote address.  This can be called multiple times per socket.
        /// </summary>
        /// <param name="address">The addr argument consists of two parts as follows: transport://address. The transport specifies the underlying transport protocol to use. The meaning of the address part is specific to the underlying transport protocol.</param>
        /// <returns>An endpoint identifier which can be used to reference the connected endpoint in the future</returns>
        /// <exception cref="NNanomsg.NanomsgException">Thrown if the address is invalid</exception>
        protected NanomsgEndpoint ConnectImpl(string address)
        {
            int endpoint = -1;

            endpoint = Interop.nn_connect(_socket, address);

            if (endpoint > 0)
            {
                return new NanomsgEndpoint()
                       {
                           ID = endpoint
                       }
            }
            ;
            else
            {
                throw new NanomsgException("nn_connect " + address);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Connects the socket to the remote address.  This can be called multiple times per socket.
        /// </summary>
        /// <param name="address">The IP address to which this client is connecting</param>
        /// <param name="port">The port number to which this client is connecting</param>
        /// <exception cref="NNanomsg.NanomsgException">Thrown if the address is invalid</exception>
        protected NanomsgEndpoint ConnectImpl(IPAddress address, int port)
        {
            int endpoint = -1;

            endpoint = Interop.nn_connect(_socket, string.Format("tcp://{0}:{1}", address, port));

            if (endpoint > 0)
            {
                return new NanomsgEndpoint()
                       {
                           ID = endpoint
                       }
            }
            ;
            else
            {
                throw new NanomsgException("nn_connect " + address);
            }
        }
Ejemplo n.º 3
0
 public static int Connect(int s, string addr)
 {
     return(Interop.nn_connect(s, addr));
 }