|
-
October 26th, 2005, 12:11 AM
#8
Re: WinsockUDP + recv() + MSG_PEEK = WSAEMSGSIZE
 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).
Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.
* While posting code sections please use CODE tags
* Please check the codeguru FAQ and do a little search to see if your question have been answered before.
* Like a post, Rate The Post
* I blog: Network programming, Bible
I do all things thru CHRIST who strengthens me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|