def test_readyNonblockTrue(self): inputStream = SocketInputStream(self.__left, Timeout.NONBLOCK) self.assertFalse(inputStream.ready())
def test_readyNonblockFalse(self): inputStream = SocketInputStream(self.__left, Timeout.NONBLOCK) self.__right.sendall('some data') self.assertTrue(inputStream.ready())
def handler(signum, frame): print "prisel signal", signum, frame signal.signal(signal.SIGHUP, handler) left, right = socket.socketpair() try: print "recv", left.recv(100) except Exception, e: print e print e.args print errno.errorcode[e.args[0]] print "errno", e.errno print "strerror", e.strerror raise exit() left.close() try: left.send("123") except socket.error, e: print errno.errorcode[e.args[0]] raise stream = SocketInputStream(left, Timeout.BLOCK) print stream.ready(Timeout.BLOCK) print stream.ready(Timeout.BLOCK) left.close() right.close()