2
0

server.py 623 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python
  2. import SocketServer
  3. from ESL import *
  4. class ESLRequestHandler(SocketServer.BaseRequestHandler ):
  5. def setup(self):
  6. print self.client_address, 'connected!'
  7. fd = self.request.fileno()
  8. print fd
  9. con = ESLconnection(fd)
  10. print "Connected: "
  11. print con.connected()
  12. if con.connected():
  13. info = con.getInfo()
  14. uuid = info.getHeader("unique-id")
  15. print uuid
  16. con.execute("answer", "", uuid)
  17. con.execute("playback", "/ram/swimp.raw", uuid);
  18. #server host is a tuple ('host', port)
  19. server = SocketServer.ThreadingTCPServer(('', 8040), ESLRequestHandler)
  20. server.serve_forever()