Beispiel #1
0
    def listen(self, factory):
        """
        What servers do. This is Twisted-speak for "bind."

        For notes about the use of deferred here, see the deffered comment in
        the docstring for ZmqConnection.connect.
        """
        try:
            self._connectOrBind(factory)
        except Exception, err:
            logging.exception(err)
            msg = util.buildErrorMessage(err)
            return defer.fail(exceptions.ListenError(msg))
Beispiel #2
0
    def connect(self, factory):
        """
        What clients do.

        The use of deferreds here is somewhat of an artiface, providing API
        similarity with Twisted code more than anything else. What's async in
        txZMQ is really the reactor checking the socket's file descriptor to
        see if there's data available to read or write.
        """
        try:
            self._connectOrBind(factory)
        except Exception, err:
            msg = util.buildErrorMessage(err)
            return defer.fail(exceptions.ConnectionError(msg))