[SDL] SDL_net and socketpair

Francesco Orsenigo xarvh at lombardiacom.it
Thu Sep 5 04:24:01 PDT 2002


José Luis Sánchez:

> Socketpair returns both socket descriptors, and is commonly followed by a
> fork().  It serves as a commodity replacement for all the above (i.e. open
> listen socket, open client socket, etc.) when the connection will take
> place on a single machine,
Exactly what i do.
I use it for the "Create Game" feature of my game.
It is quite useful if you don't want the host user to start both client and 
dedicated server....
Why SDL_net has not such feature?
Should be useful to lots of game programmers...

Creating the 2 sockets with listen, accept and connect, may take several 
seconds, is more complex and more likely to fail... socketpair() is much more 
neat.

Francesco Orsenigo, Xarvh Project




More information about the SDL mailing list