/*
 * call-seq:
 *   socket.bind(endpoint) -> nil
 *
 * Creates an endpoint for accepting connections and binds it to the socket.
 *
 * The _endpoint_ argument is a string consisting of two parts as follows:
 * _transport://address_.  The _transport_ part specifies the underlying
 * transport protocol to use.  The meaning of the _address_ part is specific
 * to the underlying transport protocol selected.
 *
 * The following transports are defined:
 *
 * [_inproc_] local in-process (inter-thread) communication transport
 * [_ipc_] local inter-process communication transport
 * [_tcp_] unicast transport using TCP
 * [_pgm_, _epgm_] reliable multicast transport using PGM
 *
 * With the exception of ZMQ:PAIR sockets, a single socket may be connected to
 * multiple endpoints using connect(), while simultaneously accepting
 * incoming connections from multiple endpoints bound to the socket using
 * bind(). Refer to ZMQ::Socket for a description of the exact semantics
 * involved when connecting or binding a socket to multiple endpoints.
 */
static VALUE socket_bind (VALUE self_, VALUE addr_)
{
    void * s;
    Data_Get_Struct (self_, void, s);
    Check_Socket (s);

    int rc = zmq_bind (s, rb_string_value_cstr (&addr_));
    if (rc != 0) {
        rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
        return Qnil;
    }

    return Qnil;
}