"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > from socket import * > > host = 'localhost' > port = 51567 > address = (host, port) > buffer_size = 1024 > > client_socket = socket(AF_INET, SOCK_STREAM) > client_socket.connect(address) > > while True: > data = raw_input('> ') > if not data: > break > client_socket.send(data) > data = client_socket.recv(buffer_size) > if not data: > break > print data > > client_socket.close()
Also, is that second "if not data: break" statement necessary? It seems like once you get past the first if, you don't need the second one. Of course, I guses it's possible that the server could return a False value, but even still, would it make sense to break out of the loop and close the connection because of that? It runs fine without the if statement, but I'm wondering if I just haven't encountered the proper problem situation yet. -- http://mail.python.org/mailman/listinfo/python-list