Guest User

Untitled

a guest
May 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import socket
  2. import pygame
  3.  
  4. pygame.init()
  5. pygame.display.set_mode((320, 240))
  6. tcpCliSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  7. tcpCliSock.connect(("10.0.0.4", 6882))
  8.  
  9. while 1:
  10. pygame.event.pump()
  11. data = " "
  12. for i in pygame.event.get(pygame.KEYDOWN):
  13. data = str(i.key)
  14. tcpCliSock.send(data)
  15. data = tcpCliSock.recv(1024)
  16. if not data: break
  17. if not data == "echoed ": print data
  18.  
  19. tcpCliSock.close()
  20. pygame.quit()
Add Comment
Please, Sign In to add comment