예제 #1
0
	def test_readyNonblockTrue(self):
		inputStream = SocketInputStream(self.__left, Timeout.NONBLOCK)
		self.assertFalse(inputStream.ready())
예제 #2
0
	def test_readyNonblockFalse(self):
		inputStream = SocketInputStream(self.__left, Timeout.NONBLOCK)
		self.__right.sendall('some data')
		self.assertTrue(inputStream.ready())
예제 #3
0
파일: sockio.py 프로젝트: lachtan/mblib
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()