Chat freely about anything...

User avatar
By ivee
#42244 This is a change in 1.5 SDK

to get IP of received UDP packet you should do the following in receive callback function


Code: Select allstatic void ICACHE_FLASH_ATTR
udpserver_recv(void *arg, char *pusrdata, unsigned short len)
{
    struct espconn *udpconn=(struct espconn *)arg;
    remot_info *premot = NULL;
    sint8 value = ESPCONN_OK;

    if (espconn_get_connection_info(udpconn,&premot,0) == ESPCONN_OK){
       udpconn->proto.udp->remote_port = premot->remote_port;
       udpconn->proto.udp->remote_ip[0] = premot->remote_ip[0];
       udpconn->proto.udp->remote_ip[1] = premot->remote_ip[1];
       udpconn->proto.udp->remote_ip[2] = premot->remote_ip[2];
       udpconn->proto.udp->remote_ip[3] = premot->remote_ip[3];

   ets_uart_printf("%d.%d.%d.%d", udpconn->proto.udp->remote_ip[0],
          udpconn->proto.udp->remote_ip[1],
          udpconn->proto.udp->remote_ip[2],
          udpconn->proto.udp->remote_ip[3]);
         // send some message back
          static const char msg[] = "ANSWER\n";
        espconn_sent(udpconn, (uint8 *)msg, sizeof(msg));
    }




}
User avatar
By TerryE
#45135 See this issue comment on the nodemcu issues list. The patch will work on any non-OS SDK app