Created
January 21, 2020 13:14
-
-
Save BMU-Verlag/d4830278ca64c8c68c9aed9816a7149f to your computer and use it in GitHub Desktop.
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
from header_utils import format_message | |
import socket | |
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
server_socket.bind((socket.gethostname(), 5555)) | |
server_socket.listen(10) | |
print (f'Listeing on {socket.gethostname()}:{5555}') | |
while True: | |
client_socket, client_address = server_socket.accept() | |
print(f'Established connection to {client_address[0]}:{client_address[1]}') | |
client_socket.send(bytes(format_message('Hello there, how are you?'), 'utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment