it seems that there is no possibility to detect if the device has been addressed by a broadcast.
Code: Select all
LOCAL struct espconn udpconn; // udp server
void user_devicefind_recv(void *arg, char *data, unsigned short data_len) {
struct espconn *pConnection = (struct espconn*)arg;
remot_info *premot = NULL;
espconn_get_connection_info(pConnection, &premot, 0); // get sender data (source IP)
os_memcpy(udpconn.proto.udp->remote_ip, premot->remote_ip, 4);
udpconn.proto.udp->remote_port = premot->remote_port;
debug("UDP remote: " IPSTR ":%d\n", IP2STR(udpconn.proto.udp->remote_ip), udpconn.proto.udp->remote_port);
// shows correct source IP
debug("UDP local: " IPSTR ":%d\n", IP2STR(pConnection->proto.udp->local_ip), pConnection->proto.udp->local_port);
// shows always the current device IP; never a broadcast address
}
Any hints?
Thanks a lot