[armedbear-devel] how to redirect format function to a socket stream
Hi, I've a socket stream named "socket" in this port and host: 50362 and localhost I've written this function to redirect format function to the socket but only appears NIL. How can I redirect format t lisp function to a socket? (defun colors() (WITH-OPEN-STREAM (socket (SOCKET:SOCKET-CONNECT 50362 "localhost")) (let ((*standard-output* socket)) (format t "The color is ~A" "red") ))) Thanks
Hi Santiago, Welcome to Armed Bear Common Lisp (and Common Lisp in general)! I've a socket stream named "socket" in this port and host: 50362 and
localhost
I've written this function to redirect format function to the socket but only appears NIL. How can I redirect format t lisp function to a socket?
(defun colors() (WITH-OPEN-STREAM (socket (SOCKET:SOCKET-CONNECT 50362 "localhost")) (let ((*standard-output* socket)) (format t "The color is ~A" "red") )))
Maybe the underlying stream wants to optimize the socket writes and keeps your write buffered for now? In that case, you want to use FORCE-OUTPUT to make sure all internal buffers get written to the stream. Hope that helps! Bye, Erik.
participants (2)
-
Erik Huelsmann
-
Santiago Carbonell