Archived

This topic is now archived and is closed to further replies.

Jodda

UDP Questions

Recommended Posts

I''m writting a simple server that has a central server, over UDP. But I can''t seem to find a general design for UDP servers out there. Im sure there is one, but where is it? Right now I am stuck on managing the ports on the server. With TCP/IP the way I learned was an incoming connection to the server is moved over to some other port, and all future connections with that client take place on this ''other'' port. Is this what you do with UDP? I am thinking that you do not, because UDP is NOT connection oriented. If I did move over to another port, how would the clients know where to send the data? My experience was with java... it just sorta magically took care of it for me. Thanks

Share this post


Link to post
Share on other sites
No, all of the clients that send data to you send to the same port. You just create the socket, bind it to the port, and then wait for data to come in on the port. You don''t have to worry about accept''ing connections, etc.


-Brannon

Share this post


Link to post
Share on other sites
Wow.. im excited that i was right thanks!

So I suppose if i want to send data to the clients that connected later I should save thier sockaddr_in structs and use them to send data back...

thanks alot

Share this post


Link to post
Share on other sites