import socket import sys # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('localhost', 8684) print(sys.stderr, 'connecting to %s port %s' % server_address) sock.connect(server_address) def send(msg): b = bytes(msg, "utf-8") sock.send(bytes("Content-Length: " + str(len(b)) + "\r\n\r\n", "ascii")) sock.send(b) send('{"seq": 1, "type": "request", "command": "setBreakpoints", "arguments": {' '"source": {"path": "TestScript"},' '"breakpoints": [{ "line": 14} ]' '} }') while True: msg = sock.recv(128) print(msg.decode("utf-8"))