class_docstr: A utility class to register callbacks when a zmq socket sends and receives
  
  For use with zmq.eventloop.ioloop
  
  There are three main methods
  
  Methods:
  
  * **on_recv(callback, copy=True):**
      register a callback to be run every time the socket has something to receive
  * **on_send(callback):**
      register a callback to be run every time you call send
  * **send(self, msg, flags=0, copy=False, callback=None):**
      perform a send that will trigger the callback
      if callback is passed, on_send is also called.
      
      There are also send_multipart(), send_json(), send_pyobj()
  
  Three other methods for deactivating the callbacks:
  
  * **stop_on_recv():**
      turn off the recv callback
  * **stop_on_send():**
      turn off the send callback
  
  which simply call ``on_<evt>(None)``.
  
  The entire socket interface, excluding direct recv methods, is also
  provided, primarily through direct-linking the methods.
  e.g.
  
  >>> stream.bind is stream.socket.bind
  True
class_docstr_tok: ["A","utility","class","to","register","callbacks","when","a","zmq","socket","sends","and","receives","For","use","with","zmq.eventloop.ioloop","There","are","three","main","methods","Methods",":","*","*","*","on_recv","(","callback",",","copy=True",")",":","*","*","register","a","callback","to","be","run","every","time","the","socket","has","something","to","receive","*","*","*","on_send","(","callback",")",":","*","*","register","a","callback","to","be","run","every","time","you","call","send","*","*","*","send","(","self",",","msg",",","flags=0",",","copy=False",",","callback=None",")",":","*","*","perform","a","send","that","will","trigger","the","callback","if","callback","is","passed",",","on_send","is","also","called",".","There","are","also","send_multipart","(",")",",","send_json","(",")",",","send_pyobj","(",")","Three","other","methods","for","deactivating","the","callbacks",":","*","*","*","stop_on_recv","(",")",":","*","*","turn","off","the","recv","callback","*","*","*","stop_on_send","(",")",":","*","*","turn","off","the","send","callback","which","simply","call","``","on_","<","evt",">","(","None",")","``",".","The","entire","socket","interface",",","excluding","direct","recv","methods",",","is","also","provided",",","primarily","through","direct-linking","the","methods",".","e.g",".",">",">",">","stream.bind","is","stream.socket.bind","True"]
docstr: rebuild io state based on self.sending() and receiving()
docstr_tok: ["rebuild","io","state","based","on","self.sending","(",")","and","receiving","(",")"]
code: def _rebuild_io_state(self):
      """rebuild io state based on self.sending() and receiving()"""
      if self.socket is None:
          return
      state = 0
      if self.receiving():
          state |= zmq.POLLIN
      if self.sending():
          state |= zmq.POLLOUT
  
      self._state = state
      self._update_handler(state)
  
imports: from __future__ import with_statement
  import sys
  import warnings
  import zmq
  from zmq.utils import jsonapi
  from .ioloop import IOLoop, gen_log
  from zmq.utils.strtypes import basestring
label_desc: Use image node_id 27 for calling the ZMQStream obj's underlying member method code with example usage: obj._rebuild_io_state() without return types