port->socket now dups both ports. This is also documented.

This commit is contained in:
mainzelm 2002-12-11 10:01:01 +00:00
parent e17a183ffe
commit a3332290c6
2 changed files with 7 additions and 7 deletions

View File

@ -128,7 +128,11 @@ is preferred to explicitly closing the inport and outport because using
\begin{desc}
This procedure turns \var{port} into a socket object. The port's
underlying file descriptor must be a socket with protocol family
\var{protocol-family}. \ex{port->socket} comes in handy for writing
\var{protocol-family}. \ex{port->socket} applies \ex{dup->inport}
and \ex{dup->outport} to \var{port} to create the ports of the
socket object.
\ex{port->socket} comes in handy for writing
servers which run as children of \texttt{inetd}: after receiving a
connection \texttt{inetd} creates a socket and passes it as
standard input to its child.

View File

@ -172,12 +172,8 @@
port
(lambda (fd)
(%getsockopt fd level/socket socket/debug)))
(let ((in (if (input-port? port)
port
(dup->inport port)))
(out (if (output-port? port)
port
(dup->outport port))))
(let ((in (dup->inport port))
(out (dup->outport port)))
(make-socket pf in out)))
(import-os-error-syscall %socket (pf type protocol) "scsh_socket")