I'm trying to communicate from a Lisp script to another program by using TCP/IP sockets (with sbcl and the usocket library in a Linux system).
So far I got this code:
(require 'asdf)
(require 'usocket)
(defun start-client ()
( usocket:with-client-socket
(socket stream "0.0.0.0" 30000)
(loop for x in '("1~%" "2~%" "3~%" "4~%" "5~%") do
(format stream x)
(force-output stream)
(sleep 1)
;;(format t "~A~%" (read-line stream))
)
)
)
(start-client)
The code works well with the exception of the commented line:
(format t "~A~%" (read-line stream))
So I'm able to send and receive the messages 1,2,3 ... from the other socket (another program) and send messages back from the other program to lisp. However, when I uncomment the line to read the messages from lisp, the above code seems to stop and wait forever.