-->
Page 1 of 1

Error on "pUdpServer->proto.udp->local_port = 7777;"

PostPosted: Fri Jan 30, 2015 4:25 pm
by JannikJung0
Hello everybody,
I'm trying to setup a tcp server on the ESP8266, but I always get a error with the "proto.udp"

Code: Select allinvalid type argument of '->' (have 'struct espconn')


Any idea ?

Jannik Jung

Re: Error on "pUdpServer->proto.udp->local_port = 7777;"

PostPosted: Sat Jan 31, 2015 7:32 pm
by sfranzyshen
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) ;
   }
}