Changeset - 7f273883de60
[Not reviewed]
default
0 1 0
drewp - 22 years ago 2002-07-13 02:57:55

messed with the server a lot. it works, though doesnt do persistent conenctions
1 file changed with 15 insertions and 4 deletions:
0 comments (0 inline, 0 general)
light8/potserver.py
Show inline comments
 
#!/usr/bin/python
 

	
 
import socket
 
import socket,time
 

	
 
from io import *
 

	
 
pots = SerialPots()
 
pots.golive()
 

	
 
laste=""
 
while 1:
 
    
 
    l=pots.getlevels()
 
        
 
    try:
 
        s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
        s.connect(("dash", socket.getservbyname('serpots','tcp')))
 

	
 
        s.setblocking(1)
 
        ret=s.connect_ex(("dash", socket.getservbyname('rlslider','tcp')))
 
#        print ret        
 
        s.send("%d %d %d %d\n" % l)
 
        s.close()
 
    except Exception,e:
 
        print "Exception: %s" % e
 
        print str(e)
 
        s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
        if ret==111:
 
            print time.ctime(),"waiting for server"
 
            time.sleep(3)
 
        else:
 
            print time.ctime(),"connected"
 

	
 

	
 

	
0 comments (0 inline, 0 general)