Hi,
I'm trying to send some strings using the format function in LISP to a sockets but always I obtain NIL
I'm using this function:
(defun sockets_fun() (WITH-OPEN-STREAM (socket (SOCKET:SOCKET-CONNECT 49729 "localhost")) (let ((*standard-output* socket)) (format socket "The color is ~A" "red") (force-output socket) (finish-output nil) )))
But always I obtain NIL in the socket
Instead of that function I've tried to use this another function:
(defun geetings() (print "hi"))
and works fine, appears hi in the socket
Why there are problems with sockets with the format function?
Thanks
Santiago Carbonell carbonell.santiago@gmail.com writes:
Hi,
I'm trying to send some strings using the format function in LISP to a sockets but always I obtain NIL
I'm using this function:
(defun sockets_fun() (WITH-OPEN-STREAM (socket (SOCKET:SOCKET-CONNECT 49729 "localhost")) (let ((*standard-output* socket)) (format socket "The color is ~A" "red") (force-output socket) (finish-output nil) )))
But always I obtain NIL in the socket
It works well:
[pjb@kuiper :0 tmp]$ nc -t -l -p 49729 & [2] 21094 [pjb@kuiper :0 tmp]$ clisp -q -ansi -norc -x '(defun socket-fun () (WITH-OPEN-STREAM (socket (SOCKET:SOCKET-CONNECT 49729 "localhost")) (let ((*standard-output* socket)) (format socket "The color is ~A" "red") (force-output socket) (finish-output nil))))' -x '(socket-fun)' SOCKET-FUNThe color is red NIL [2]+ Done nc -t -l -p 49729 [pjb@kuiper :0 tmp]$
Why there are problems with sockets with the format function?
There's no problem with format.
But I'm wondering why you're asking a clisp question on an armedbear mailing list?
armedbear-devel@common-lisp.net