www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/27/16:02:05

Date: Wed, 27 Jan 93 15:27:21 EST
From: ronis AT onsager DOT chem DOT mcgill DOT ca (David Ronis)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Sockets and DV/X

There have been several messages concerning ports to dv/x using the
libraries supplied by Quarterdeck.  I've been trying to port
ghostview.  Unfortunately, while it is very simple to get the code to
compile, open its windows, etc., I've been unsuccessful at getting it
to work properly.  In short, ghostview acts as a front-end to
ghostscript (which has been ported to DV/X and which works fine).  The
communication is done via pipes() and fork() which don't work in djgpp
and dv/x.

Of course, being able to create new processes under DV/X and have
socket capabilities, should fix the problem, right?  Unfortunately, it
doesn't for two reasons:

1.  You cannot redirect the stdin, stderr, etc.  of the child process
to files or streams opened by the parent.

and more importantly

2.  The socket routines do not support stream or read/write IO; you
must use the send/receive routines.  Read() or write() to a socket
don't work, nor can you close a socket using close().

Thus if you want to port a routine which spawns a subprocess and then
communicates with it via pipes, you must set up the socket connections
you need (this is not the hard part) and then modify all the IO calls
to use the appropriate send/receive routines.  If the standard
read/write calls worked, then it would be a simple matter to open the
sockets, connect, and then use dup2 to set the required file handles.

For new code, it is probably not to difficult to use the required
routines, although being able to use standard IO calls is preferable.
For a program which uses widgets and pipes, each of which assuming
that the IO can come from the tty, a file, or a socket, the job of
porting is a mess.

If anyone has a work-around, I'd be interested in knowning it.

In addition, does anyone know what the so_init() and so_exit() really
do?  I've written test socket programs that seem to work without
calling them.

Thanks in advance,


David Ronis

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019