[SDL] SDL_net and socketpair
bob at pendleton.com
Thu Sep 5 17:21:00 PDT 2002
Neil Griffiths wrote:
> Hello Bob,
> BP> Lets step back and think about this for a moment. I see why you would
> BP> want to use socketpair for the application that was mentioned. But, is
> BP> this really something to add to SDL_net? Or, should we be thinking about
> BP> an new library, SDL_process, that provides the functionality of fork,
> BP> exec, popen, and interprocess communication? I think we could come up
> BP> with a small set of APIs that are both portable and cover the need to
> BP> create processes and communicate with them. I guess what I'm saying is
> BP> that there isn't much point in having a portable version of socketpair
> BP> if there isn't a portable fork or popen or what not.
> That makes sense. I was thinking about SDL_net because of sockets, but
> you have a point there. Perhaps a better name would be SDL_system? But
> either way, the name isn't important - the idea is.
> I'll certainly write a socketpair() replacement very quickly, I'll get
> it done at the weekend as a bit of a break from GBA programming. But
> the rest of it would still need to be written. Would you be interested
> in helping?
I can help on the UNIX/Linux side, but its been 6 years since I wrote
any native Windows code. All the code I've written on Windows in that
time was in Java. And, Java ain't Windows. :-)
> BP> Personally, I would prefer an API like popen that gives me a
> BP> bidirectional connection to the new process. I know how to do that with
> BP> standard Unix APIs, but it would be so nice to have one simple API to do
> BP> the job.
> Yes, you're right. I've been using popen() when writing a server at
> work and found pthreads quite nice. I never needed bidirectional
> connections because of the modular design, but I can definitely see
> where it would be useful!
I posted code on USENET in 1988 called ile.c that forks and execs
another program and communicates with it over pty/tty pairs. That code
should give us a good idea how to do a popen with with bidirectional
communication. I can post the code, send it to you, or you can find a
shell archive at
+ Bob Pendleton, consultant for hire +
+ Resume: http://www.jump.net/~bobp +
+ Email: bob at pendleton.com +
More information about the SDL