-
 /*
     NanoSocket.swift
 

            sendPriority = try getSocketOption(self, .SendPriority)        // obtain the send priority for the end-point.
        }

        return SocketPriorities(receivePriority: receivePriority, sendPriority: sendPriority)
    }

    /// Adds a local endpoint to the socket. The endpoint can be then used by other applications to connect to.

    /// - Note:    Note that `bindToURL()` may be called multiple times on the same socket thus allowing the
    ///            socket to communicate with multiple heterogeneous endpoints.
    public func bindToURL(_ url: URL, name: String = "") throws -> EndPoint {
        return try self._establishEndPoint(url: url, name: name, type: .Bind, {
            try url.absoluteString.withCString { address in
                let endPointId = nn_bind(self.fileDescriptor, address)

                guard (endPointId >= 0) else {
                    throw NanoMessageError.BindToURL(code: nn_errno(), url: url)
                }

                return endPointId
            }
        })
    }

    /// Adds a local endpoint to the socket. The endpoint can be then used by other applications to connect to.
