Created
December 10, 2019 04:28
-
-
Save NimishMishra/e21d583a2f7000a90d454739315837e5 to your computer and use it in GitHub Desktop.
A simple server sending some message
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 | |
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