anchor.diff:                              (length (socket-write-buffer socket)))
                       (setf (socket-write-buffer socket) nil)
                       (when (queue-empty-p (socket-write-queue socket))
  -                      (on-socket-output-empty driver socket))))
  +                      (if (socket-close-after-drain-p socket)
  +                          (finish-close socket)
  +                          (on-socket-output-empty driver socket)))))
                 (continue () nil)
                 (drop-connection () (close socket :abort t)))))
           (when (queue-empty-p (socket-write-queue socket))
  
positive.code:                     SOCKET-EXTERNAL-FORMAT-OUT will only be used when converting input strings for
                      output -- binary input data (as through WRITE-SEQUENCE) will not be
                      converted. SOCKET-EXTERNAL-FORMAT-IN is not used at all in binary mode.
                      This value can be changed after a socket has already been created."))
    (:prefix socket-))
  
  ;;; Implementation
  
negative.code:                          (socket-event-base socket)))
      (iolib:remove-fd-handlers evbase
                                (iolib:socket-os-fd (socket-internal-socket socket))
                                :read t :error t)
      (cond (abort
             (finish-close socket))
            (t
             (setf (socket-close-after-drain-p socket) t)
             nil))))
  
  (defun finish-close (socket)
    (when-let (evbase (and (slot-boundp socket 'internal-socket)
                           (socket-event-base socket)))
      (iolib:remove-fd-handlers evbase
                               (iolib:socket-os-fd (socket-internal-socket socket))
                               :write t)
      (when-let (server (socket-server socket))
        (remhash socket (server-connections server)))
      (close (socket-internal-socket socket) :abort t)
      (unregister-socket socket))
    (on-socket-close (socket-driver socket) socket)
    t)
  
  (defun socket-connect (driver host &key
                         (port 0)
  