Advertisement
j7sx

Untitled

Jul 7th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. #-*- coding: utf-8 -*-
  2. from socket import *
  3.  
  4. HOST = 'localhost'
  5. PORT = 8000
  6. s = socket(AF_INET, SOCK_STREAM)
  7. s.bind((HOST, PORT))
  8. s.listen(1)
  9. conn, addr = s.accept()
  10. print 'Connected from', addr
  11. while True:
  12.     data = conn.recv(1024)
  13.     print "Received", repr(data)
  14.     reply = raw_input("Reply: ")
  15.     conn.sendall(reply)
  16.  
  17. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement