AnsweredAssumed Answered

Incoming Socket Client during AT command (HTTPGET)

Question asked by Fredriksson.Mathias on Nov 2, 2016

I've been testing the socket server (AT+S.SOCKD=32000) on the SPWF01SA and noticed that whenever a client connects the Wi-Fi module immediately enters data mode. This seemed like a potential problem so I decided to test it while waiting for the result from an AT command (HTTPGET).

Interestingly, the message from the socket client is printed immediately on the UART (no WIND!) and the AT command does not complete until the socket client disconnects. After the socket client disconnects the response from the AT command is printed followed by four WINDs (61, 60, 59, 62).

This behaviour makes it dangerous to have a socket server active while issuing any AT command.

If a socket client has connected previously, I am able to enter and exit data mode (at+s.) with success. If there is incoming socket data during this time I properly get WIND 64 (pending data) and am able to receive it later (with at+s.).

Example to reproduce (UI = UART Input, UO = UART Output, # = PC Terminal). Also note HTTPGET must take e.g. 2 seconds to respond so there is time to issue telnet before response:

UI: AT+S.SOCKD=32000\r
UI: AT+S.HTTPGET=,/test,8080
#: telnet 32000
#: telnet> hello from telnet
#: quit telnet (after e.g. 1 minute)
UO: hello from telnet\r\n
UO: HTTP/1.0 200 OK\r\n
UO: Date: Wed, 02 Nov 2016 17:19:49 GMT\r\n
UO: Content-Length: 15\r\n
UO: Content-Type: text/plain; charset=utf-8\r\n
UO: \r\n
UO: hello from http\r\n\r\n
UO: \r\nOK\r\n
UO: \r\n+WIND:61:Incoming Socket Client:\r\n
UO: \r\n+WIND:60:Now in Data Mode\r\n
UO: \r\n+WIND:59:Back to Command Mode\r\n
UO: \r\n+WIND:62:Socket Client Gone:\r\n

As you can see, the telnet hello is the first in the buffer, followed by HTTP response, then AT command status and finally delayed WIND.

Is it possible to work around this issue in any way?

PS. I'm running the latest firmware (160129-c5bf5ce).