Skip to content

read blocking forever on local sockets? #79

@Ambrevar

Description

@Ambrevar

When using read-line and write-line it seems to work:

(let ((path "/tmp/foo.socket"))
  (unwind-protect (iolib:with-open-socket (s :address-family :local
                                             :connect :passive
                                             :local-filename (uiop:native-namestring path))
                    (iolib:with-accept-connection (conn s)
                      (values (read-line conn)
                              (progn (write-line "result" conn)))))
    (uiop:delete-file-if-exists path)))


;; Other REPL
(iolib:with-open-socket (s :address-family :local
                           :remote-filename (uiop:native-namestring "/tmp/foo.socket"))
  (write-line "foo" s)
  (finish-output s)
  (read-line s))

Now switch to read and write:

(let ((path "/tmp/foo.socket"))
  (unwind-protect (iolib:with-open-socket (s :address-family :local
                                             :connect :passive
                                             :local-filename (uiop:native-namestring path))
                    (iolib:with-accept-connection (conn s)
                      (values (read conn)
                              (progn (write "result" :stream conn)))))
    (uiop:delete-file-if-exists path)))

;; Other REPL
(iolib:with-open-socket (s :address-family :local
                           :remote-filename (uiop:native-namestring "/tmp/foo.socket"))
  (write "foo" :stream s)
  (finish-output s)
  (read s))

It hangs forever.

Bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions