Created
September 1, 2015 14:22
Python_Socket_Server
This file contains hidden or 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 = 9999 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
host = '127.0.0.1' | |
s.bind((host, port)) | |
s.listen(5) | |
print "listen ok" | |
while True: | |
c, addr= s.accept() | |
print 'connection', addr | |
c.send('Connection success') | |
c.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment