Skip to content

Instantly share code, notes, and snippets.

@NimishMishra
Last active December 10, 2019 03:57
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 NimishMishra/286d6616e049077e4a2a8fb525949b74 to your computer and use it in GitHub Desktop.
Save NimishMishra/286d6616e049077e4a2a8fb525949b74 to your computer and use it in GitHub Desktop.
A very basic skeleton of a socket server
import socket
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection.bind((socket.gethostname(), 8000))
connection.listen(5)
while True:
connectedsocket, address = connection.accept()
print("Connection from {address} established".format(address = address))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment