scsh-hackers
[Top] [All Lists]

[Scsh-hackers] port->socket

To: scsh-hackers <scsh-hackers@lists.sourceforge.net>
Subject: [Scsh-hackers] port->socket
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Mon Apr 15 00:26:14 2002
List-id: Discussion among the implementors <scsh-hackers.lists.sourceforge.net>
Sender: scsh-hackers-admin@lists.sourceforge.net
Servers which are children of inted get the socket they have to serve
passed as stdin. In scsh the respective port needs to be converted
into a socket object somehow. I have added a procedure port->socket

(define (port->socket port pf)
  ;;; ensure underlying fd is a socket by a random getsockopt call
  (if (not (port? port))
      (error "first argument to port->socket is not a port" port))
  (sleazy-call/fdes
   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))))
    (make-socket pf in out)))


to the network code a little while ago and I would like to release it
in 0.6.2.

Any comments? 

-- 
Martin


<Prev in Thread] Current Thread [Next in Thread>