本文整理汇总了C++中EthernetClient::remoteIP方法的典型用法代码示例。如果您正苦于以下问题:C++ EthernetClient::remoteIP方法的具体用法?C++ EthernetClient::remoteIP怎么用?C++ EthernetClient::remoteIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EthernetClient
的用法示例。
在下文中一共展示了EthernetClient::remoteIP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
WebClient* NetworkInterfaceWIZ5x00::processPacket () {
WebClient *ret = NULL;
EthernetClient client = server.available ();
if (client) {
DPRINT (F("New client from "));
DPRINTLN (client.remoteIP ());
// An http request ends with a blank line
boolean currentLineIsBlank = true;
ethernetBufferSize = 0;
boolean copy = true;
while (client.connected ()) {
if (client.available ()) {
char c = client.read ();
if (copy) {
if (ethernetBufferSize < sizeof (ethernetBuffer)) {
ethernetBuffer[ethernetBufferSize++] = c;
} else {
DPRINTLN (F("Ethernet buffer overflow"));
break;
}
}
// If you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
if (c == '\n' && currentLineIsBlank) {
webClient.begin (client, (char *) ethernetBuffer);
ret = &webClient;
break;
}
if (c == '\n') {
// See if we got the URL line
if (strncmp_P ((char *) ethernetBuffer, PSTR ("GET "), 4) == 0) {
// Yes, ignore the rest
ethernetBuffer[ethernetBufferSize - 1] = '\0';
copy = false;
} else {
// No, start over
ethernetBufferSize = 0;
}
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
//delay (500);
// If we are not returning a client, close the connection
if (!ret) {
client.stop ();
DPRINTLN (F("Client disconnected"));
}
}
return ret;
}