[ENet-discuss] Help with scatter/gather on CE platform

Lee Salzman lsalzman at telerama.com
Tue Mar 9 17:20:16 PST 2004


Whoa, there is a MUCH simpler way to do this than you are doing (in
fact, there is one and only one way to do it). Making multiple calls 
to sendto()/recvfrom() is definitely going to screw up the result 
since the data must arrive in one UDP packet. The best way to do
this is to define one static, global buffer (it only need be as large as
ENET_PROTOCOL_MAXIMUM_MTU), and then copy all the parts into that buffer 
as one big UDP packet, then finally send it out via one call to sendto.
This is in fact exactly how the scatter-gather IO behaves, only that is 
done by the OS in a cheaper fashion. The reverse case, one call to
recvfrom() then disperse it to each buffer as necessary, operates more
or less similarly.

Lee

On Tue, Mar 09, 2004 at 03:14:15PM -0800, Pete Diemert wrote:
> Hello, so far so good with ENet.  We have ported the library to the Windows 
> CE platform (3.0) in order to take advantage of the UDP capability on PDAs, 
> however, we are experiencing some problems in that the 
> WSASendTo/WSARecvFrom API are not supported on CE3.0 and instead we must 
> use the original winsock sendto()/recvfrom().  This means we must "fake" 
> the scatter/gather functionality of the newer WSA functions.  To make the 
> port as easy as possible we simply converted the single call to WSASendTo() 
> into several calls to sendto().  We are finding that this causes problems 
> (presumably with packet header/ordering info) when we try to send from the 
> PDA (using the "faked" sendto() implementation) to a desktop computer 
> (using the current WSARecvFrom()).  The data arrives but is disregarded due 
> to bad packet ordinals.
> 
> To make a long story short, has anyone modified ENet to use the standard 
> winsock api instead of the WSA functions?  If not, is there an easy 
> workaround that allows us to remove the WSA functions?
> 
> Any help would be greatly appreciated.
> 
> thanks,
> Pete Diemert
> 



More information about the ENet-discuss mailing list