I'm attempting to set up an extremely simple server that receives a string, and returns a string. However, I have 2 problems. I'm able to receive the string from the client fine, but it only will receive it once. After I send another string from the client, it doesn't come up on the server... Also, I want to send something BACK to the client-side, but I can't seem to see how... Please help! I'm very new to networking, but I've been using Python for a while now, just recent;y getting into networking, trying to get things down.
SERVER.PY: import socket; serverReady = True; serverSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM); serverSock.bind(('localhost', 8081)); serverSock.listen(10); while (True): connection, address = serverSock.accept(); if (serverReady): serverSockBuffer = connection.recv(1024); if (len(serverSockBuffer) > 0): print serverSockBuffer; if (raw_input("Ready?: ") in ['yes', 'y']): serverReady = True; else: serverReady = False; CLIENT.PY: import socket; clientSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM); clientSock.connect(('localhost', 8081)); user = raw_input("Username: "); while (True): sendData = raw_input("Send: "); clientSock.send(str(sendData + ' -- ' + user)); print clientSock; -- https://mail.python.org/mailman/listinfo/python-list