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:

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)
print('Received', repr(data))