Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket,time
- eki = socket.socket()
- eki.bind(('', 54321))
- eki.listen(1)
- while True:
- conn, addr = eki.accept()
- print( 'robot connected:', addr )
- i = 1
- data, addr = conn.recvfrom(1024)
- print( "Got: " + str(data) )
- while True:
- try:
- s = "<Atos><A>TRUE</A><B>FALSE</B><C>TRUE</C></Atos>"
- s = '<Atos><Task Active="1" Code="%i"/></Atos>' % i
- conn.send(bytes(s, encoding='ascii'))
- print( "Sent: %s" % s )
- time.sleep(3)
- i = i + 1
- except Exception as e:
- print( e )
- raise e
- break
- conn.close()
- atos.close()
- eki.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement