[armedbear-devel] sockets in CLISP
Pascal J. Bourguignon
pjb at informatimago.com
Fri May 18 09:47:34 UTC 2012
Santiago Carbonell <carbonell.santiago at 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 at kuiper :0 tmp]$ nc -t -l -p 49729 &
[2] 21094
[pjb at 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 at 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?
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
More information about the armedbear-devel
mailing list