#Hello I need some help writing a text
1 messages ยท Page 1 of 1 (latest)
This plugin is written in Python, so you don't need to be familiar with VIM at all to help.
TTS has a game open, and I have confirmed that it's listening on port 39998. Here's the payload I'm sending:
Sending: b'{"messageID": 3, "guid": "-1", "script": "print(\"Hello, World\")"}\n'
It looks like the server's port goes into the FIN_WAIT_2 state after I attempt to send data. Maybe that's relevant...
Does it have to be a python plugin? I previously used a node module for it which successfully communicated with TTS.
It doesn't have to be python, though I'm very curious what I need to fix.
Do you have the ports right? TTS listens on 39999 for messages.
how do you send this though?
I have the ports right.
I send via:
def client(ip, port, json_dict):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.settimeout(11)
Connect to server
try:
sock.connect((ip, port))
except ConnectionRefusedError:
print('Connection Refused: Is TTS running? Should it be restarted?')
return
# Send data
payload = (dumps(json_dict) + '\n').encode('utf-8')
print(f"Sending: {payload}")
sock.sendall(payload)
# Shutdown without receiving data. TTS sends on a different socket.
sock.close()
sock.shutdown(1)
assuming ip is localhost and port is 39999
๐
I assume that Connect to server is actually commented.
Yup ๐
I'm not sure what you mean. If you're talking about sock.connect(), here's the documentation: https://docs.python.org/3/library/socket.html#socket.socket.connect
I just looked at the snippet you posted, it looks to me like there is a missing #.
Oh, let me check...
Yeah, copypasta error ๐คฆโโ๏ธ
So, I can get it all working with netcat. So maybe I should use nc to debug this a little more. I'll let you know how it goes.
So... When I open netcat to listed for TTS's response: nc -l 127.0.0.1 39998
I get no response after VIM sends using that send function. I suspect I'm sending the JSON in a format that TTS isn't expecting.
When I send trash to TTS via nc on 39999, it doesn't even bother replying over 39998. That makes me think I'm sending "trash" from my send function. Maybe I'm converting my JSON dict to a byte object in a silly way.
Ok, working with netcat shows that neither my client nor my server work with TTS.