Komut
remoteIP()
Açıklama
İstemcinin IP adresini döndürür.
Sözdizimi
istemci .remoteIP ()
Parametreler
Yok
İadeler
istemcinin IP adresi ( IPAdresi ).
Misal
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
Serial.print("Remote IP address: ");
Serial.println(client.remoteIP());
client.stop();
}
}
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
Serial.print("Remote IP address: ");
Serial.println(client.remoteIP());
client.stop();
}
}
Ayrıca bakınız