# client.py # Simple non-object way to connect to a server and send commands # Sky Coyote for SWRI 2007 # Import modules used import socket # Connect to server and return socket object def connect(): s = socket.socket() host = socket.gethostname() port = 1234 s.connect((host, port)) print s.recv(1024) return s # Send command over socket and get synchronous reply def command(s, data): s.send(data) print s.recv(1024)