parameters: (self, buffer_size)
docstring: Fix for windows sockets throwing EAGAIN crashing asyncore
docstring_summary: Fix for windows sockets throwing EAGAIN crashing asyncore
docstring_tokens: Fix for windows sockets throwing EAGAIN crashing asyncore
function: def recv(self, buffer_size):
          """Fix for windows sockets throwing EAGAIN crashing asyncore"""
          while True:
              try:
                  data = self.socket.recv(buffer_size)
                  if not data:
                      # a closed connection is indicated by signaling
                      # a read condition, and having recv() return 0.
                      print("JsonClient: Socket closed...")
                      self.handle_close()
                      return ''
                  else:
                      return data
              except socket.error as why:
                  # winsock sometimes throws ENOTCONN
                  if why.args[0] in (errno.EAGAIN, errno.EWOULDBLOCK):
                      #print "EGAIN or EWOULDBLOCK returned... spin waiting"
                      time.sleep(0.001)
                      continue
                  elif why.args[0] == errno.ENOTCONN:
                      self.handle_close()
                      return ''
                  else:
                      raise
function_tokens: def recv ( self , buffer_size ) : while True : try : data = self . socket . recv ( buffer_size ) if not data : # a closed connection is indicated by signaling # a read condition, and having recv() return 0. print ( "JsonClient: Socket closed..." ) self . handle_close ( ) return '' else : return data except socket . error as why : # winsock sometimes throws ENOTCONN if why . args [ 0 ] in ( errno . EAGAIN , errno . EWOULDBLOCK ) : #print "EGAIN or EWOULDBLOCK returned... spin waiting" time . sleep ( 0.001 ) continue elif why . args [ 0 ] == errno . ENOTCONN : self . handle_close ( ) return '' else : raise