Mike Gran <[EMAIL PROTECTED]> writes:
>
> I wrote a peer-to-peer ap where I used "(display data socket)" to send
> and "(read-string!/partial block socket-port)" to receive.
That'd be the ticket, I use a `socketpair' and read-string to talk back
and forward to a child process. You have to have an ugly
fork/exec/whatever yourself of course (fragment below). In any case the
soft ports thingie certainly ought to have a read-string operation, you
can't do input a character at a time.
(let* ((pair (socketpair PF_UNIX SOCK_STREAM 0))
(parent-sock (car pair))
(child-sock (cdr pair))
(errport (mkstemp-ext ""))
(pid (primitive-fork)))
(if (eqv? 0 pid) ;; child
(catch #t
(lambda ()
(dup2 (fileno child-sock) 0)
(dup2 (fileno child-sock) 1)
(dup2 (fileno errport) 2)
(port-for-each
(lambda (port)
(false-if-exception ;; for non-fd ports and/or close errors
(let ((fd (fileno port)))
(or (<= fd 2)
(close-fdes fd))))))
(apply execlp (first args) args))
(lambda errargs
(primitive-_exit 127))))
;; parent
(close-port child-sock)
_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user