Udp Sockets: ports and bind
I was wondering, why must I bind a udp socket. If I remember correctly with udp sockets you specify the ip address and port when you sendto messages and with recvfrom you have these details stored in a varibale of struct sockaddr type.
So if I don't bind the socket of the server does this mean that it will listen to a random port or not at all?
Also in the client side, you just create a socket and then sendto a message with the details of the server (IP, port). Does the socket get bind(ed) automatically by the system to a random port and uses that from then on?
MT means never missing a packet
That is exactly why having an MT server for such things set up is essential on any server other than a play server; if there is a packet, grab it and stash it into a queue or something so that you don't lost packets at times of high congestion. For UDP its easier b/c unless you are doing something using multipacket messages, have a thread sit there and suck in packets (while packets are waiting) and stuffing them into a queue for processing by another thread is the way to go. For TCP it gets a little more interesting but the process is essentially the same, only instead of stashing a packet you are stashing a socket connection...
Originally Posted by brewbuck