Wifi Question
hooktxu
Posts: 33
Hi, I have a wifi secure socket and I have to put a WPA password to connect to ir correctly. I use this code but it give me an error.
serialIWi.str(string("AT+iWLSI=red)) serialIWi.tx($0D) i:= 0 repeat iWLSIResponse[i]:=serialIWi.rx i++ while NOT(iWLSIResponse[noparse][[/noparse]i-1]==$0A) serialPC.str(@iWLSIResponse[noparse][[/noparse]0]) serialPC.str(string("MoreLab2 OK")) ''------------------- serialIWi.str(string("AT+iWSTO=3")) serialIWi.tx($0D) i:= 0 repeat iWST0Response[i]:=serialIWi.rx i++ while NOT(iWST0Response[noparse][[/noparse]i-1]==$0A) serialPC.str(@iWST0Response[noparse][[/noparse]0]) serialPC.str(string("WEP OK")) ''------------------- serialIWi.str(string("AT+iWLPP=modjjjdu")) serialIWi.tx($0D) i:= 0 repeat iWLPPResponse[i]:=serialIWi.rx i++ while NOT(iWLPPResponse[noparse][[/noparse]i-1]==$0A) serialPC.str(@iWLPPResponse[noparse][[/noparse]0]) serialPC.str(string("Clave OK")) [/i][/i][/i]
Comments
I assume it's both:
1.
2.
Same problem for the other responses!
3.
You don't add the string terminator after reading the response. Is the response fixed in size? I'd replace the $0a with a $0 or add a $0 after the response.
Plus .. you don't check for the size of the response. That could produce buffer overflows, for example if you don't set the baudrade adequate on both sides ... or if you have noise on the communication lines ....
Post Edited (MagIO2) : 7/7/2009 8:58:15 AM GMT