I need to send AT commands over ethernet to a device to configure it. Here is what I have right now:
import socket
import sys
import time
host = "192.168.0.99"
port = 8080
msg = 'at\n'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send(msg.encode())
data = s.recv(1024).decode()
print (data)
s.close()
I can putty to it, open a raw connection and it works.
I type in "at", the controller echos "at" followed by an "ok" to acknowledge.
When I run the above script, I get "at" back. Is it printing the echo and not the following line (the ok line) or is it just printing out the command I sent out? How do I get it to read all the data that's received?