Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created January 21, 2020 13:17
Show Gist options
  • Save BMU-Verlag/7032175ba570db98bb00aaf5773a48bb to your computer and use it in GitHub Desktop.
Save BMU-Verlag/7032175ba570db98bb00aaf5773a48bb to your computer and use it in GitHub Desktop.
# client.py
from header_utils import HEADER_SIZE
import socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((socket.gethostname(), 5555))
while True:
message_size = client_socket.recv(HEADER_SIZE)
if message_size:
message_size = int(message_size.strip())
message = client_socket.recv(message_size)
print(message.decode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment