Chat freely about anything...

User avatar
By sfranzyshen
#8664
Code: Select all#include "espconn.h"
#include "mem.h"
#include "user_interface.h"

static struct espconn *pUdpServer;

void user_init(void)
{
   pUdpServer = (struct espconn *)os_zalloc(sizeof(struct espconn));
   ets_memset( pUdpServer, 0, sizeof( struct espconn ) );
   espconn_create( pUdpServer );
   pUdpServer->type = ESPCONN_UDP;
   pUdpServer->proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp));
   pUdpServer->proto.udp->local_port = 7777;
   espconn_regist_recvcb(pUdpServer, udpserver_recv);

   if( espconn_create( pUdpServer ) )
   {
      while(1) ;
   }
}