WiFly GSX sending HTTP GET request

I am trying to set up my WiFly GSX RN-131C module to send data to a local webserver running on my laptop. No Arduinos involved at the moment- just the WiFly module connected to maybe some temperature sensors outside or something like that. Part of the reason for this project is that I wanted to learn more about HTTP, TCP and Servers and I certainly have done so in the last couple of weeks but I have hit a brick wall.

I have successfully set up servers on my laptop and connected the WiFly via my wireless router. By the way I found a really interesting little server for windows called Tinyweb http://www.ritlabs.com/en/products/tinyweb/- I had problems getting it working but it is really small and requires very little resources.

The problem is specifically with the GET request as described in “13. Using HTML client feature” of the WiFly GSX manual. The server just does not respond to the request from the WiFly.

The WiFly connects fine and I get “listen on 2000” so we can assume that I’ve set up the wlan commands correctly. The rest of the commands I give the WiFly (via the UART) are:

set ip proto 18

set ip host 192.168.1.67 (laptop local address)

set ip remote 80

set com remote GET$/cgi-bin/test.cmd?DATA=

set q sensor 0xff

set sys auto 10

set option format 7

save

reboot

Essentially it’s copying out of the manual but changing parameters so it connects to my local server rather than http://www.something.com

test.cmd is a collection of simple DOS commands to create a directory which would indicate that it has been run. I am not even trying to get the data out of the request yet. Don’t laugh but I intend to use a QBASIC program to extract the data.

I wonder if it’s something to do with the fact that the WiFly only adds \n to the end of the GET request rather than \r\n. I downloaded a protocol analyser and noticed that GET requests from a browser end in \r\n and the WiFly GET request ends in \n.

The other reason I wonder this is that if I forget about the sensors and autoconnection (set sys auto 0) and simply use the command…

set com remote GET$/

when I type the command open I get HTML back from the server through the UART but only after I send a \r from the UART (i.e. type return on the keyboard of the computer connected via serial port to the UART for programming the WiFly).

I am starting to wander if anyone has ever successfully achieved sending data via HTTP from the WiFly on its own or is everyone using it with an Arduino? Is it actually impossible? Of course the more likely explanation is the one piece of information that is missing from my brain. Can anyone help?

How do you know the server is working right? What is the server supposed to respond to? Can you post the server code?

Hi, Thanks for the reply!

If I telnet into the server on port 80 and type:

GET / HTTP/1.0 {enter}{enter}

then I get HTTP/1.0 200 OK, Date, Server info and the text of the index.html page back into the telnet window. Also the page comes up in a browser when I type in the laptop local address. This suggests to me that the server is probably working.

If I attempt to get the WiFly to effectively send the same request, I use the command to the WiFly via the serial port:

set com remote GET$/

I then send the command:

open

I get OPEN back but the server does not send an HTTP response.

I confirm using Wireshark that an HTTP request is sent to the server, but only after I type an extra carraige return into the UART, and even then an HTTP response is not sent back. The server does however send some TCP stuff back which I don’t really understand. Is this what you mean by server code? If you mean php code then there’s none on the server at the moment- I just want to get it to respond at this stage.

Well, I’ve decided to use a palmtop connected to the UART of the WiFly to generate the correct HTTP format. I’ve concluded that the problem is that the server I am using does not respond to \n\n at the end of the GET request but needs \r\n\r\n (carraige return & line return). The palmtop queries the WiFly sensors, converts the reading into a GET request, sends the command “open” to the WiFly, waits for “open” to come back and then sends the GET request (with \r\n\r\n at the end).