Python3 tcp client and server

Substitute for command line netcat (nc)

Running nc from the Max [shell] object was not only slow, but also caused audio clicks in CubicSDR. So here’s a link to python code using sockets to build a tcp client and server.  from this link: https://stackoverflow.com/questions/34653875/python-how-to-send-data-over-tcp

import socket

host = socket.gethostname()
port = 12345                   # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.sendall(b'Hello, world')
data = s.recv(1024)
s.close()
print('Received', repr(data))