SDL_net on Mac OS X debugging weirdness

Hi there,

I’m kind of an SDL newbie, but I’m having a consistently reproducible
problem with SDL_net on Mac OS X. Here’s the relevant code snippet:

if ( SDLNet_SocketReady(servsock) ) {
TCPsocket newsock;
newsock = SDLNet_TCP_Accept(servsock);
if (newsock == NULL) {
printf(“SDLNet_TCP_Accept: %s\n”, SDLNet_GetError());
}
}

I’m trying to accept connections to a server, using SDLNet_TCP_Accept
(). The program works perfectly on *nix or Windows/Cygwin. On Mac OS
X, however, any time a connection to the server is opened (via
telnet, say) newsock is NULL, and SDLNet_GetError() returns the
message “accept() failed”.

The very strange thing is, if I run the server program from inside
gdb, everything works perfectly. SDLNet_TCP_Accept() returns the
appropriate socket, and the program functions properly. No error.

I’ve looked through the SDL_net source, but nothing seemed obviously
connected to this problem to me. Does anyone have some idea of why
SDLNet_TCP_Accept() would work when called by a program running in
gdb, and fail outside of gdb?

Thanks very much,
Andre Arko