[SDL] Accel. OpenGL on SDL Platforms

Joe Tennies rotund at fatnsoft.com
Wed Sep 18 22:05:01 PDT 2002

Hello Francesco,

FO> Ehm, socketpair() creates a pair of INTERCONNECTED sockets.

Yes, but as I said before, it's not portable. I'm showing you a

FO> False.
FO> I can socketpair(), fork() and then send() and recv() data back and forth 
FO> between parent and child.
FO> Without any call to listen(), accept() or connect().

Not just by using socketpair() you can't. If using TCP, you'd still
have to connect, else how does it know where to send the data? You
could use sendto() though with UDP.

FO> If you are saying that is possible to call socket() twice and then connect 
FO> somehow the two created sockets, tell me how (i'm new with network 
FO> programming) because it should do exactly what i need.

You don't need to though, that's my point. I'm showing you a perfectly
portable method - and have given you a reason why it's not in SDL_net.
If you really, REALLY want to use interconnected sockets, use shared
memory, but I think that's a really nasty solution. Doing something

typedef struct {
SOCKET send;
SOCKET recv;
} sock_t;

is very similar to how you want, portable and just generally neater to
understand. And as fast. If you really need to share sockets, I would
suggest you re-think your design!


More information about the SDL mailing list