本文整理汇总了C++中EthernetClient::status方法的典型用法代码示例。如果您正苦于以下问题:C++ EthernetClient::status方法的具体用法?C++ EthernetClient::status怎么用?C++ EthernetClient::status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EthernetClient
的用法示例。
在下文中一共展示了EthernetClient::status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: networkManage
void networkManage() {
uint16_t size;
if (sendClient.available()) {
// int size = sendClient.read((uint8_t *) buf2, BUFFER_SIZE);
size = readHttpFrame(sendClient);
#ifdef HMAC
if (!isTimeReady()) {
uint16_t endPos = strstrpos_P((char *) buf, DOUBLE_ENDL);
receiveTime((char *) &buf[endPos + 4]);
}
#endif
}
#ifdef HMAC
if (!isTimeReady() && sendClient.status() == SnSR::CLOSED && (lastFailTime == 0 || millis() - lastFailTime > dateFailRetryWait)) {
if (sendClient.connect(NotifyDstIp, notifyDstPort)) {
int len = clientBuildTimeQuery((char *) buf);
sendClient.write(buf, len);
} else {
lastFailTime = millis();
sendClient.stop();
}
}
#endif
if (!sendClient.connected()) {
sendClient.stop();
}
if (notification != 0 && sendClient.status() == SnSR::CLOSED) {
// there is a notif and we are not handling another one
if (lastFailTime == 0 || millis() - lastFailTime > notifFailRetryWait) {
if (sendClient.connect(NotifyDstIp, notifyDstPort)) {
int len = clientBuildNextQuery((char *) buf);
sendClient.write(buf, len);
} else {
lastFailTime = millis();
sendClient.stop();
}
}
}
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
size = readHttpFrame(client);
if (size > 0) {
buf[size] = 0;
size = handleWebRequest((char *) buf, 0, size);
buf[size] = 0;
client.println((const char *) buf);
}
delay(1);
client.stop();
}
}
}
if (needReboot) {
resetFunc();
}
}