[En-Nut-Discussion] Problem with NutUdpReceiveFrom

Petr Halas petr.halas at seznam.cz
Thu Jul 10 21:50:45 CEST 2003


Hi,
I have this code on Ethernut OS 3.2.1:

--- snip ----------------------------------------------
THREAD(UDPsetup, arg)
{
     UDPSOCKET    *sock;
     char         *buf;
     int          len;
     u_long       address;
     u_short      port;

     NutSleep(2000);
     sock = NutUdpCreateSocket(9999);
     buf = NutHeapAlloc(512);

     for(;;) {
         if((len = NutUdpReceiveFrom(sock, &address, &port, buf,
sizeof(buf), 50000)) > 0) {
             buf[len] = 0;
	    fprintf(uart0,"%s\n",buf);
     	}

         NutThreadYield();
     }

     NutHeapFree(buf);
}

--- snip ----------------------------------------------

When any UDP packet arrive Ethernut OS do reboot.
Can anybody help me with this problem?

Thanks Petr






More information about the En-Nut-Discussion mailing list