Last active
July 19, 2016 15:48
-
-
Save corynissen/5659933 to your computer and use it in GitHub Desktop.
python socket client example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
client_socket.connect(("localhost", 6011)) | |
while 1: | |
data = raw_input ( "Enter text to be upper-cased, q to quit\n" ) | |
client_socket.send(data) | |
if ( data == 'q' or data == 'Q'): | |
client_socket.close() | |
break; | |
else: | |
data = client_socket.recv(5000) | |
print "Your upper cased text: " , data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment