Created
July 15, 2013 09:06
-
-
Save mudge/5998546 to your computer and use it in GitHub Desktop.
An extremely simple HTTP echo server in Python for testing requests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
port = 3001 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(('localhost', port)) | |
s.listen(5) | |
while 1: | |
client, address = s.accept() | |
data = client.recv(1024) | |
if data: | |
print data | |
client.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment