/ Published in: Python
Client code for sending information to the logging server.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# SocketServer_Client.py # Version: 1.0 # Use: Internal Application (Work) # Purpose: Client-side code for sending information to the server. # Copyright (C)2014 Jordan Rowles # GNU General Public License Version 3 or Later import socket import sys HOST, PORT = 'localhost', 9999 DATA = " ".join(sys.argv[1:]) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: sock.connect((HOST, PORT)) sock.sendall(DATA+"\n") received = sock.recv(1024) finally: sock.close() print " Sent: {}".format(DATA) print "Received: {}".format(received)
URL: SocketServer-Client