Skip to content

Instantly share code, notes, and snippets.

@techniq
Created August 23, 2012 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techniq/3437628 to your computer and use it in GitHub Desktop.
Save techniq/3437628 to your computer and use it in GitHub Desktop.
Simple Echo Server
#!/usr/bin/env python
"""
A simple echo server
"""
import socket
host = ''
port = 50000
backlog = 5
size = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host,port))
s.listen(backlog)
while 1:
client, address = s.accept()
data = client.recv(size)
if data:
#client.send(data)
client.send('success')
print data
client.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment