import socket import select import os from threading import Thread, currentThread _selectfunction=select.select if os.name=="java": from select import cpython_compatible_select as _selectfunction s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(("",9999)) s.listen(5) print "Listening:",s.getsockname() DATASIZE=500 def handle(csock): print "thread %s connected to client %s" % (currentThread(), csock.getpeername()) while True: rsock,wsock,esock=_selectfunction([csock],[],[],2) # <-- causes the crash if csock in rsock: data="" while len(data)