🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
recvfrom() ?
does recvfrom() let you specify who u wana recv from or does it just tell u who you did recv from?
Yes, this is one of the benifits of using a UDP server - you can use one socket to send/receive all the incomming packets and process them accordingly. The recvfrom function tells you which client the packet has come from. The other main alternative, TCP server, has a listening socket which then creates a new socket for every connected client. This becomes more complicated to manage within the server program.
This is obviously an oversimplification of the situations but gives an idea of the differences.
Henry
This is obviously an oversimplification of the situations but gives an idea of the differences.
Henry
quote: Original post by henryx
The other main alternative, TCP server, has a listening socket which then creates a new socket for every connected client. This becomes more complicated to manage within the server program.
This is obviously an oversimplification of the situations but gives an idea of the differences.
At least with TCP, you don''t have to check for lost or out-of-order packets.
I agree with you Fruny, that with TCP you don''t need to check for lost or out-of-order packets - but it may be that the overheads associated with doing this in UDP are less than managing all the sockets in TCP.
This is probably a discussion that could go on for a long time:
ie advantages/disadvantages of using TCP/UDP! Any contributions?
This is probably a discussion that could go on for a long time:
ie advantages/disadvantages of using TCP/UDP! Any contributions?
You can use connect() and recv()/send() as normal using UDP sockets which you may find easier for the clients code. Then use sendto() and recvfrom() at the server to handle the multiple clients over the one port.
UDP is faster than TCP due to the fact there is no guarantee of the packet arriving or arriving in order. It is however, relatively easy to manage packet ordering and guaranteed delivery using your own protocol where as with TCP you HAVE to have guaranteed and ordered delivery. There are numerous arguments about the merits of each all over this board but it boils down to a general consensus that UDP is quicker and with a proper implementation, ''better'' than TCP.
UDP is faster than TCP due to the fact there is no guarantee of the packet arriving or arriving in order. It is however, relatively easy to manage packet ordering and guaranteed delivery using your own protocol where as with TCP you HAVE to have guaranteed and ordered delivery. There are numerous arguments about the merits of each all over this board but it boils down to a general consensus that UDP is quicker and with a proper implementation, ''better'' than TCP.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement