Quote Originally Posted by MrDoomMaster
Well, since I am using this code in a DirectX game, I suppose I can't really use MSG_PEEK, since it has been mentioned that it degrades performance.

Anyone have a different idea on how to send packets more efficiently?
When it comes to UDP, it is always better for a send to result in one datagram. What I mean is if the data is more that the MTU (actually after subtracting the IP and UDP header length), the IP packet gets fragmented. And fragmentation is always better to be avoided, including performance degradation reasons.

So UDP is good if

#1 You don't care if the packet reaches or not.

#2 The data in one send does not go beyond the network MTU

#3 A message unit is containted in a single datagram.

#4 The receive side always have sufficient buffer to hold/receive the data.

As a side note, as already mentioned, MSG_PEEK must always be avoided. Not only it is highly inefficienet, it is buggy as well(regarding to the count).