import socket def test(): sock = socket.socket() sock.connect(('192.168.31.199', 1919)) data = sock.recv(50) sock.close() print(data) test()