Advertisement
Guest User

Untitled

a guest
May 24th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import sys
  2.  
  3.  
  4. host="192.168.1.18" # Set the server address to variable host
  5. port=4447 # Sets the variable port to 4446
  6. from socket import * # Imports socket module
  7.  
  8. s=socket(AF_INET, SOCK_STREAM)
  9.  
  10. s.bind((host,port)) # Binds the socket. Note that the input to
  11. # the bind function is a tuple
  12.  
  13. s.listen(1) # Sets socket to listening state with a queue
  14. # of 1 connection
  15.  
  16. print "Listening for connections.. "
  17.  
  18. q,addr=s.accept()
  19. while True:
  20. line = sys.stdin.readline()
  21. sp1 = line.split (' ')
  22. sp1 = filter(None, sp1)
  23.  
  24. if sp1[0] == "quat":
  25.  
  26. q.send(sp1[1] +";"+ sp1[2] + ";"+ sp1[3]+";"+sp1[4]+"\n")
  27.  
  28. s.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement