Search code examples
pythonpython-2.7socketstelnetat-command

AT commands with Telnet / Socket in python


I have a device that i want to send AT commands i am able to connect to the device with telnet or with a socket.

My issue is that i am unable to send the AT command or know how to receive it, i have found a few articles about this subject but they all talk about serial connection.

My question is what would be the proper way to send an AT commands if i am connected to the terminal by Telnet or a Socket and to receive the response

i have tried both socket.send("AT\n") and telnet.write(b"AT")

"AT" should just respond with "OK" status


Solution

  • Correct AT command handling is as follows:

    You need to send the command line, then read and parse (framing) AT command responses until you receive a Final result code.

    See this answer (or this, this or some of my other answers) for details on how the logic for reading and parsing should be.