anchor.diff:               (socket:remote-port conn)))
        conn)
      #+digitool
  -   (let* ((s (listener-stream socket))
  -          (state (and s (ccl::opentransport-stream-connection-state s)))
  -          (new nil))
  -     (when (member state '(:incon :dataxfer))
  -       (mess 3 "Accepting connection ~S" s)
  -       (setq new s
  -             state nil))
  -     (when (member state '(nil :uninit :closed))
  -       (mess 3 "New listener replacing ~S" s)
  -       (or (mcl-listener-port socket)
  -           (error "MCL OpenTransport needs explicit port number for listener socket"))
  -       (setf (listener-stream socket)
  -         (ccl::open-tcp-stream nil (mcl-listener-port socket) 
  -                               :element-type '(unsigned-byte 8)
  -                               :reuse-local-port-p t)))
  -     new)))
  -
  -
  -;;; Socket status
  -#|
  -OpenTransport states
  - :closed 
  - :uninit   - reset ?
  - :unbnd    - closed ?
  - :idle 
  - :outcon   - syn-sent
  - :incon    - listen
  - :dataxfer - established
  - :outrel   - closing
  - :inrel    - closing
  -|#
  +   (let* ((s (listener-stream socket)))
  +     (when (and s blocking)
  +       (flet ((ready-p (s)
  +                (not (eql (ccl::opentransport-stream-connection-state s) :unbnd))))
  +         (unless (ready-p s)
  +           (ccl:process-wait "waiting" #'ready-p s))))
  +
  +     (let ((state (and s (ccl::opentransport-stream-connection-state s)))
  +           (new nil))
  +       
  +       (when (member state '(:incon :dataxfer))
  +         (mess 3 "Accepting connection ~S" s)
  +         (setq new s
  +               state nil))
  +       (when (member state '(nil :uninit :closed))
  +         (mess 3 "New listener replacing ~S" s)
  +         (or (mcl-listener-port socket)
  +             (error "MCL OpenTransport needs explicit port number for listener socket"))
  +         (setf (listener-stream socket)
  +               (ccl::open-tcp-stream nil (mcl-listener-port socket) 
  +                                     :element-type '(unsigned-byte 8)
  +                                     :reuse-local-port-p t)))
  +       new))))
  +
  +
   
   (defun socket-stream-closed-p (stream)
     (%SYSDEP
  
positive.code: 
     #+digitool
     (let ((state (ccl::opentransport-stream-connection-state stream)))
       (not (member state '(:outcon :incon :dataxfer))))
  
     ;; Default, assume it is not closed
     nil))
  
  
  ;; Check if input is directly available on (socket) stream
  ;; if this returns false positives and wait-for-input-on-streams
  ;; returns :cant the server functionallity is severly reduced :()
  (defun socket-stream-listen (stream)
    (declare (ignorable stream))
    (%SYSDEP 
  
negative.code:    (eq t (ext:read-byte-lookahead stream))
     ;;(not (ext:read-byte-will-hang-p stream))
     #+clisp t                            ;Ouch!
  
     #+CCL
     (or (listen stream)
         (ccl:stream-eofp stream)
         (socket-stream-closed-p stream))
  
     ;; Default
     (listen stream))) 
  