[En-Nut-Discussion] How to use UDP sockets

Ralph Mason ralph.mason at telogis.com
Mon Jul 7 07:00:00 CEST 2003


Port 0 is not valid.

Try another port in your NutUdpCreateSocket call (say 10112)

Then from your clients send to the Nut ip address at 10112 (sendto)

Remember the size of a UDP packet is limited the MTU of the network
(generally around 1500 bytes).

Ralph


> -----Original Message-----
> From: en-nut-discussion-admin at egnite.de
> [mailto:en-nut-discussion-admin at egnite.de]On Behalf Of Hugo Simon
> Sent: Monday, 7 July 2003 4:50
> To: en-nut-discussion at egnite.de
> Subject: Re: [En-Nut-Discussion] How to use UDP sockets
>
>
> Hi,
>
> the DOS part seems ok now, but the Ethernut simply ignores my UDP packets,
> take a look at my code to see whats wrong.
> I looked at the source of NutUdpReceiveFrom, and it seems that I
> don't need
> to _give_ the IP adress of the sender but I receive it from the
> function, as
> is the port adress. But nothing happens, I am running into timeouts.
>
> Thank you
> Thorsten
>
>
> THREAD(udpReceiver,arg)
> {
>   UDPSOCKET *udpsock;
>   u_long  addr;
>   u_short port=4950;
>   int     size;
>   static char bufr[4096];
>
>   if ((udpsock=NutUdpCreateSocket(0)))
>   {
>    for (;;)
>    {
>     size=NutUdpReceiveFrom(udpsock, &addr, &port, bufr, 4096, 1000);
>     if (size>0)
>      printf("%i Bytes received from %s:%i\n",size, inet_ntoa(addr),port);
>     else
>       if (size==0) putchar('T');
>       else putchar('.');
>    }
>   }
>   else
>     puts("Creation of UDP socket failed");
>   for (;;);
> }
>
>
>
>
>
> ----- Original Message -----
> From: Hugo Simon <hugo.simon at gmx.de>
> To: <en-nut-discussion at egnite.de>
> Sent: Sunday, July 06, 2003 2:17 PM
> Subject: [En-Nut-Discussion] How to use UDP sockets
>
>
> > Hi!
> >
> > Can anyone help me. Since the senders are DOS computers running WATTCP
> some
> > info on that part is also interesting, you may send it private if it is
> > offtopic here.
> >
> > Thank you
> > Thorsten
> >
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003




More information about the En-Nut-Discussion mailing list