[SDL] Net2: question

Vassilis Virvilis vasvir at iit.demokritos.gr
Fri Sep 8 01:19:14 PDT 2006


I am investigating SDL_Net and I am using the
excellent Net2 library by Bob Pendleton. Note that
Net2 is a thin layer around SDL_net and does not perform
any swaping.

But I think it should do.

The problem:
I am calling
NET2_UDPAcceptOn(int port) which calls
SDLNet_UDP_Open(int port)
which accepts native byte order integer. So far so good.

Now when I am receiving UDP packets on this port, the
source port number is swapped. OK. let's just accept
that. This is the network.

Now when I am trying to send using

NET2_UDPSend(IPaddress *ip, char *buf, int len) which calls
SDLNet_UDP_Send(requires UDPpacket)
the ip->port member must be jammed again -- unlike the other uses
of IPaddresses

I believe since NET2_UDPSend requires an IPaddress it should
be noted with __very__ big letters in the documentation.
better hide the swap inside NET2_UDPSend and during the receipt
of the UDPpacket.


More information about the SDL mailing list