add IPAddress remoteIP(uint8_t num)

update example
This commit is contained in:
Markus Sattler
2015-05-23 09:47:39 +02:00
parent 44c00d2dd9
commit 2798232074
3 changed files with 26 additions and 5 deletions

View File

@ -200,7 +200,7 @@ void WebSocketsServer::disconnect(void) {
/**
* disconnect one client
* @param num
* @param num uint8_t client id
*/
void WebSocketsServer::disconnect(uint8_t num) {
if(num >= WEBSOCKETS_SERVER_CLIENT_MAX) {
@ -212,6 +212,22 @@ void WebSocketsServer::disconnect(uint8_t num) {
}
}
/**
* get an IP for a client
* @param num uint8_t client id
* @return IPAddress
*/
IPAddress WebSocketsServer::remoteIP(uint8_t num) {
if(num < WEBSOCKETS_SERVER_CLIENT_MAX) {
WSclient_t * client = &_clients[num];
if(clientIsConnected(client)) {
return client->tcp.remoteIP();
}
}
return IPAddress();
}
//#################################################################################
//#################################################################################
//#################################################################################