Skip to content

Commit

Permalink
define .fileno() on Socket
Browse files Browse the repository at this point in the history
enables getting FD in eventloops like tornado
  • Loading branch information
minrk committed Jun 1, 2017
1 parent dbbf659 commit 850f23c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion zmq/sugar/socket.py
Expand Up @@ -148,7 +148,18 @@ def __setattr__(self, key, value):
self.set(zmq.UNSUBSCRIBE, value)
return
super(Socket, self).__setattr__(key, value)


def fileno(self):
"""Return edge-triggered file descriptor for this socket.
This is a read-only edge-triggered file descriptor for both read and write events on this socket.
It is important that all available events be consumed when an event is detected,
otherwise the read event will not trigger again.
.. versionadded:: 17.0
"""
return self.FD

def subscribe(self, topic):
"""Subscribe to a topic
Expand Down

0 comments on commit 850f23c

Please sign in to comment.