import socket TCP_IP = '127.0.0.1' TCP_PORT = 30002 BUFFER_SIZE = 1024 message = "12.3,20.15" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) s.send(message.encode('utf-8')) s.close()