Python Threading? or something better?
hey, im trying to make a server-client program that might need to receive data while having the option to type and send data. Threads are making alot of bugs and problems. i found out something like this: while 1: socket_list = [sys.stdin, s] # Get the list sockets which are readable ready_to_read,ready_to_write,in_error = select.select(socket_list , [], []) for sock in ready_to_read: if sock == s: # incoming message from remote server, s data = sock.recv(4096) if not data : print '\nDisconnected from chat server' sys.exit() else : #print data sys.stdout.write(data) sys.stdout.write('[Me] '); sys.stdout.flush() else : # user entered a message msg = sys.stdin.readline() s.send(msg) sys.stdout.write('[Me] '); sys.stdout.flush() now, i dont understand what are all the sys.stdin and all the rest of these sys.std lines.. can anyone explain how it works? btw, this is the client-side... the server-side is fine...