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