You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I am trying to set up a new GSTcpClient which reuses the GSModule created by the Wifi backpack. I am unable to connect to an address in my local network.
void connectToServer() {
GSModule *gsPtr;
gsPtr = &pinoccio::WifiModule::instance.bp()->gs;
GSTcpClient client = GSTcpClient(*gsPtr);
IPAddress ip;
char* url = SERVER_LOCATION;
if (!gsPtr->parseIpAddress(&ip, url)) {
ip = gsPtr->dnsLookup(url);
if (ip == INADDR_NONE) {
Serial.print(F("Failed to resolve "));
Serial.print(url);
Serial.println(F(", reassociating to retry"));
return;
}
}
if (!client.connect(ip, 8000)) {
Serial.println(F("HQ connection failed, reassociating to retry"));
pinoccio::WifiModule::instance.bp()->associate();
return;
}
client.print("Hello"); // Should print a raw GET or POST request
client.flush();
return;
}
I've dug into what's causing the error and I can pinpoint to the following:
client.connect(ip, 8000) (line 75) is returning false
GSModule::cid_t cid = gs.connectTcp(ip, port) is setting cid to INVALID_CID.
Turning verbose logging from the GS Chipset is resulting in the following output:
The output you see is exepected - that tells the chip to stop the Network Connection Manager, disassociate and then start NCM again to associate.
You're probably trying to connect before the chip has associated to the network (you can check WifiModule::instance.isAPConnected() for this IIRC). However, your loop should retry after a few seconds, so it should work eventually.
However, the delay in the loop should certainly go. I'm not sure if it causes these problems, but it prevents various parts of the code to actually respond timely in what's happening - the loop shouid always keep spinning...
Hi I am trying to set up a new GSTcpClient which reuses the GSModule created by the Wifi backpack. I am unable to connect to an address in my local network.
I've dug into what's causing the error and I can pinpoint to the following:
client.connect(ip, 8000)
(line 75) is returningfalse
GSModule::cid_t cid = gs.connectTcp(ip, port)
is settingcid
toINVALID_CID
.Anyone here knows what's the root of this problem?
My code can be found at https://github.com/vicngtor/OyoroiPinoccio/blob/master/Test/TcpCall/TcpCall.ino
The text was updated successfully, but these errors were encountered: