Created
January 21, 2020 13:16
-
-
Save BMU-Verlag/b0db12efa26738593149ce970d70594f 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
# server.py | |
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