Mercurial > code > home > repos > light9
view light8/potserver.py @ 88:238fbd5266ea
new server that sends levels like "55 25 47 35\n" on the port 'serpots'
author | drewp |
---|---|
date | Sat, 13 Jul 2002 02:28:18 +0000 |
parents | 45b12307c695 |
children | 7f273883de60 |
line wrap: on
line source
#!/usr/bin/python import socket from io import * pots = SerialPots() pots.golive() while 1: l=pots.getlevels() try: s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("dash", socket.getservbyname('serpots','tcp'))) s.send("%d %d %d %d\n" % l) s.close() except Exception,e: print "Exception: %s" % e