Pages: 1 [2]   Go Down
Author Topic: WiFlySerial and WiFly RN-XV  (Read 4277 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok found the issue, this:

Code:
   // Build GET expression
    strRequest << F("GET ") << MY_SERVER_GET_URL << F("?count=") << iLoopCounter
    << F(" HTTP/1.0") << "\n"
    << F("Host: ") << MY_SERVER_GET << "\n"
    << F("Connection: close") << "\n"
    << "\n\n";
    // send data via request
    // close connection

is not a true or correct GET request (I don't know which it is or why and I would quite like to know why).  So my php check for the GET request was failing:

Code:
if ($_SERVER['REQUEST_METHOD'] == 'GET')

It didn't fail through the browser, command line or my Max/MSP tests as they are all true GET requests.  The request string is almost identical to the one in the WebClientGetPost example that comes with WiFly (I just changed the variable and value) so that must be wrong as it's normal to check php side if it's a GET or POST request (amongst some other checks to see if the request originates from the right source).

Thanks for all your help and patience pylon, this I think has been technically the most gruelling thing I've ever done.

Garrett
« Last Edit: July 18, 2012, 07:21:42 am by garrettlynch » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found it: "\n" is just a newline, a correct client request must have "\r\n" to end a line.

client.println() does that automatically.

I haven't seen this detail though...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found it: "\n" is just a newline, a correct client request must have "\r\n" to end a line.

mmm I tried changing them all and no difference. 

Code:
// Build GET expression
    strRequest << F("GET ") << MY_SERVER_GET_URL << F("?count=") << iLoopCounter
    << F(" HTTP/1.0") << "\r\n"
    << F("Host: ") << MY_SERVER_GET << "\r\n"
    << F("Connection: close") << "\r\n"
    << "\r\n";
    // send data via request
    // close connection

What's strange is when I look at the output in the serial monitor, it looks like this:

Code:
$$$set u m 1 set u b 9600 vershow conn open www.mysite.com 80GET /in-progress/arduino-test/counter/index.php?count=17 HTTP/1.0
Host: www.mysite.com
Connection: close

The GET is pushed right up against the 80.  I tried a \r\n there as well (which would make sense since php doesn't see it as a GET) but it didn't make any difference.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you checked your Streaming library if the << operator is doing what you expect it to do? The standard Print class does not support that operator.

Quote
The GET is pushed right up against the 80

This is probably correct as "open www.mysite.com 80" is a command for the RN-XV. You don't see the response to it, which is probably CONNECT. Then you send the data for that connection which directly starts with a GET.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you checked your Streaming library if the << operator is doing what you expect it to do? The standard Print class does not support that operator.

Rather than pick apart the streaming library ( I wouldn't know where to begin) I've tried this:

Code:
strRequest = "GET " + String(MY_SERVER_GET_URL) + "?count=" + iLoopCounter + " HTTP/1.0\n" + "Host: " + String(MY_SERVER_GET) + "\n" + "Connection: close\n\n\n";

which looks a lot more familar to me.  Works fine when the php GET check isn't there but fails with the check as the other string did.
Logged

Pages: 1 [2]   Go Up
Jump to: