               (unless (find ip *emdocs-outgoing-clients*
                            :test #'emdocs-is-ip-from-client)
                (emdocs-connect-client buffer ip))
-             (emdocs-broadcast-message msg))))))
+              (emdocs-broadcast-message msg)))
+          (dump-buffer
+           (with-current-buffer buffer
+             (process-send-string sock (buffer-string))
+             (delete-process sock))))))
 
 (defun emdocs-setup-server (my-ip)
   "docstring"

                                  :attached-buffer (if (bufferp buffer)
                                                       (buffer-name buffer)
                                                     buffer)
                                  :ip ip)))))

(defun emdocs-broadcast-message (msg)
  "docstring"

  (let* ((json-object-type 'plist)
         (json-msg (json-read-from-string msg))
         (buffer (plist-get json-msg :buffer))
         (ip (plist-get json-msg :ip))
         (dump-buffer (plist-get json-msg :dump_buffer)))
    (cond (ip                           ; if given buffer and ip to connect to
           (unless (find ip *emdocs-incoming-clients*
                         :test #'emdocs-is-ip-from-client)
