Hello guys,
I'm trying to implement some simple networking with SBCL, and am
currently trying to use trivial-sockets since my needs are pretty
trivial.
My problem is that read-char-no-hang doesn't behave as I expect it to.
(with-open-stream (stream (trivial-sockets:open-stream "hostname"
port))
(format stream "request")
(force-output stream)
(read-char-no-hang stream) ; Hangs if there's no
input)
Why is it hanging? I'm probably misunderstanding how all the functions
work, but it looks like it's waiting for data to come in on the stream.
Is there any way to avoid this issue?
Higher level issue: all I need to do is write and read strings from a
socket -- note that the strings are null delimited and thus, newlines
can't be expected. Is there an easy and hopefully portable way of
doing that? I know there's a SoC project for a unified socket library,
but I don't want to wait.
Thanks,
Alex