Page 1 of 1

Where to send UDP packet to?

Posted: Tue May 25, 2010 12:10 pm
by ckoehler
Hello,

I am trying to rewrite a TCP/IP implementation into UDP for speed. I get the connection thing with TCP/IP, so I know how to get the client's IP address.
How do I do that with UDP? I'd like the client(s) to connect to a port and the board to start sending data via UDP then. Can I get a list of connected clients somehow and send the packet to them?

The examples I saw always prompted for an IP address to send to.

Thanks!

Christoph

Re: Where to send UDP packet to?

Posted: Tue May 25, 2010 12:52 pm
by Forrest
Hello Christoph,

This is explained in detail in chapter 13 (UDP Chapter) of the Programmers Guide, located @ \nburn\docs\NetworkProgrammersGuide. You should find all you need to know on both server/client UDP connections.

Re: Where to send UDP packet to?

Posted: Tue May 25, 2010 3:21 pm
by ckoehler
Thank you!

What are some best practices for working with UDP, like when the destination host isn't available anymore?

Christoph

Re: Where to send UDP packet to?

Posted: Tue May 25, 2010 7:04 pm
by v8dave
The problem with UDP is that it does not give any indication of a lost destination. There is no connection and confirmation as you would get with a TCP connection. If you need this capability you will need to use a TCP connection and detect the failure to connect.

With UDP you can also do a broadcast so that all devices on the network will see the message. I do this with a weather station so that any device on the network can pickup the message and use it if required. Not ideal for sending lots of fast data though. The weather station only sends a few bytes every 5 seconds.

Dave...