Skip to content

Instantly share code, notes, and snippets.

@NimishMishra
Created December 10, 2019 04:28
Show Gist options
  • Save NimishMishra/e21d583a2f7000a90d454739315837e5 to your computer and use it in GitHub Desktop.
Save NimishMishra/e21d583a2f7000a90d454739315837e5 to your computer and use it in GitHub Desktop.
A simple server sending some message
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))
connectedsocket.send(bytes("First message", "utf-8"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment