SDLNet_ResolveIP() problem on mac osx and ubuntu

Dear all,

My function below works fine on Windows (XP+Vista), but never succeeds on
Mac Os (10.5) or Ubuntu (9.04). Does anybody know why?

// SDLNET_Init() has been called!

string DetermineIpAddress(void)

{

string      s = "unknown";

const char  *host;

IPaddress   address;

            Uint16      port(80);

            Uint32      ipaddr;

            char        c[256];



address.host = 0;

address.port = 69;

if( (host = SDLNet_ResolveIP(&address)) != NULL )

{  

    // Windows will get to here, Mac Os & Ubuntu won't

    SDLNet_ResolveHost(&address, host, port);

    ipaddr=SDL_SwapBE32(address.host);

    sprintf(c, "%d.%d.%d.%d", ipaddr>>24, (ipaddr>>16)&0xff,

(ipaddr>>8)&0xff, ipaddr&0xff);

    s = c;

}



return s;

}

Thanks for the help,

Maarten

Hi.

This is a wild guess, but it might be because Windows allows regular
users to use all ports, while port numbers under 1024 are usually
reserved for the root user on Unix type OSes. Try it with a different
port number.On Wed, Jun 10, 2009 at 11:20 AM, Maarten Engels - Visual Productions<m.engels at visualproductions.nl> wrote:

Dear all,

My function below works fine on Windows (XP+Vista), but never succeeds on
Mac Os (10.5) or Ubuntu (9.04). Does anybody know why?