为什么每次侦询都返回Device Offline呢?
明明我的设备已经连接到服务器了。
而且奇怪的是刚开始能收到一些字符,cuuuuuu,不知道是怎么回事。
下面是接收以及发送部分的代码
- /* Read data until either the connection is closed, or the idle timeout is reached. */
- unsigned long lastRead = millis();
- while (IoTclient.connected() && (millis() - lastRead < TIMEOUT_MS)) {
- while (IoTclient.available()) {
- char c = IoTclient.read();
- Serial.print(c);
- sprintf(clientString,"%s%s%s%s%s","GET /data?token=",TOKEN,"¶m=","Rec"," HTTP/1.1");
- IoTclient.fastrprintln(clientString);
- IoTclient.fastrprint(F("\r\n"));
- IoTclient.fastrprint(F("\r\n"));
- lastRead = millis();
- }
- }
复制代码
|