When accessing socket as file:
file.flush()
after file.write()
\n
at end of message and readline()
for readingstruct
). Then send data payload. On receiver side: read exactly 4 bytes and then N bytes specified in header.b
mode, use str.encode()
to convert strings into bytes