I couldn't figure out how the patches work on codeplex so I post this here.
I'm using a RN-XV WiFly module 2.32 to connect to my WiFi and issue a request to my web server every few seconds. I used the .NET Micro Framework Toolbox for that, but I had some minor problems. Most of them are fixed and now I wanted to share my changes with you in order that they'll get included in the Toolbox.
1) WiFlyGSX._CommandMode_Start() hangs
At the end of that method is a while loop which waits until command mode was entered. Unfortunately there is no timeout like in OpenSocket, so if this._Mode is not changed, then it waits forever.
I found the problem when I enabled DebugMode. When the program hung, then the last lines in the debug window were:
O: $$$ I: <2.32> CMD\r\nI.e. sometimes my WiFly responds to the $$$ to enter the command mode with "<2.32> CMD\r\n" instead of just "CMD".
I could fix this in _SerialPort_LineReceived(). I changed
if (Text == "CMD" && this._Mode == Modes.Idle)to
if (this._Mode == Modes.Idle && Text.IndexOf("CMD") > -1)
2) HTTP_Client.HTTP_Response.ResponseBody starts with "\r\n\r\n"
These are actually the line feeds to seperate the HTTP headers from the body and should not be part of the body. I changed the HTTP_Response constructor to this:
public HTTP_Response(string ResponseData) { // First, find the point that breaks between headers and content int BreakPoint = ResponseData.IndexOf("\r\n\r\n"); if (BreakPoint > -1) { this._ResponseBody = ResponseData.Substring(BreakPoint + 4); } else { BreakPoint = ResponseData.IndexOf("\n\n"); // Lets set the response apart if (BreakPoint > -1) this._ResponseBody = ResponseData.Substring(BreakPoint + 2); else BreakPoint = ResponseData.Length; // no response body found -> take all as headers } // The headers remain this._Headers = ResponseData.Substring(0, BreakPoint).Split('\n'); // The first header also contains the ResponseCode if (this._Headers.Length > 0) { string[] Parts = this._Headers[0].Split(' '); this._ResponseCode = int.Parse(Parts[1]); } }This also does the work of Parse_Header(). This method mainly copied arrays which is actually not needed. The method can be removed now.
3) ResponseBody sometimes ends with "*CLOS*"
I didn't fix this yet. It should be somewhere in WiFlyGSX._SerialPort_DataReceived but I don't know when this happens exactly.
4) Timeout in WiFlyGSX.OpenSocket
Sometimes the socket does not get connected. But I also did not find this issue yet. As it is only on program start and not in subsequent requests, I guess something was not initialized properly.