Hi,
I have the following code which works only when using particle sim. If I try to compile the same code with 3rd party sim card (cellular data is ON), it doesnt work. Please help me understand if there is anything I need to enable for 3rd party sim card to do http get.
I am able to get “connected to server success” message, but no response in client.read.
void setup()
{
// Make sure your Serial Terminal app is closed before powering your device
Serial.begin(9600);
// Wait for a USB serial connection for up to 30 seconds
waitFor(Serial.isConnected, 30000);
Serial.println("connecting...");
if (client.connect(hostname, 8080))
{
Serial.println("connected to server success");
client.print("GET ");
client.print(path);
client.print(" HTTP/1.0\r\n");
client.print("HOST: ");
client.println(hostname);
client.println();
client.println("Content-Length: 0");
client.println();
}
else
{
Serial.println("connection failed");
}
}
void loop()
{
if (client.available())
{
String cmd = client.readStringUntil('\n'); //client.read();
Serial.printlnf("%s\n", cmd.c_str());
}
if (!client.connected())
{
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;);
}
}