Advertisement
tomateblue

ServerBigRobot.py

Mar 3rd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import socket
  4. from BigRobot import Move
  5. from BigRobot import Sensores
  6.  
  7. TCP_IP = '127.0.0.1'
  8. TCP_PORT = 5005
  9. BUFFER_SIZE = 20  # Normally 1024, but we want fast response
  10.  
  11. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  12. s.bind((TCP_IP, TCP_PORT))
  13. s.listen(1)
  14.  
  15. conn, addr = s.accept()
  16. print 'Connection address:', addr
  17. while 1:
  18.     data = conn.recv(BUFFER_SIZE)
  19.     if not data: break
  20.     print "received data:", data
  21.     m = Move(data)
  22.     m.mover()
  23.     conn.send(data)  # echo
  24.     print "=> " ,data
  25. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement