[SDL] SDLNet_TCP_Send and SIGPIPE (Linux)

Antti Mannisto amannist at twilight.cs.hut.fi
Wed Jan 19 07:16:19 PST 2005

  My network game has worked for ages in Windows, but now that
I made a Linux version of it, there seem to be random crashes
every now and then. Everything has been made on top of SDL so the
code is identical. It is very hard to debug the problem since
a server may crash once in a month or so, but debug information
suggests that crashes might be related to SDLNet_TCP_Send.
With Valgrind, I am able to make send/SLNet_TCP_Send signal
SIGPIPE (and thus crash) when I disconnect from a server at a
certain time. It also seems that players with worse connections
are getting this problem more often.

  Could this be a bug in SDL_net/SDL? I am using the latest library
versions (1.2.8 for SDL) and I can read in the change log that SDL
1.2.7 should have made SIGPIPE non-fatal, but what could then
explain this? Is it just Valgrind that is not working? And what
should I do to get rid of the problem? Define my own signal handler?

  Would something get broken or could the problem be fixed
if I add "signal(SIGPIPE, SIG_IGN)" to somewhere in my code?
Where should it be put? After SDL and SDL_net have been initialized?

  I made a search on this and found these two related articles
but are they still valid? Is SDL_net still buggy?

More information about the SDL mailing list