Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created January 21, 2020 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/39c6fbd0c1e3fd2e0de85e12dd49dcdb to your computer and use it in GitHub Desktop.
Save BMU-Verlag/39c6fbd0c1e3fd2e0de85e12dd49dcdb to your computer and use it in GitHub Desktop.
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