Re: Closing Sockets

Sven Hartrumpf <[email protected]>
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
Hi.

Thu, 3 Apr 2014 00:21:30 -0300, fernando.ribeiro wrote:
> From the docs, socket-shutdown should call socket-close when the close
> parameter is #t, but I am having issues with the following code:
> 
> (define socket (make-client-socket "localhost" 61613))
> 
> (socket-shutdown socket) ; doesn't seem to call socket-close, or as least
> not to flush the output port

I looked into the underlying C function 'socket_shutdown' (in file
runtime/Clib/csocket.c).
It calls shutdown first and contains a comment by Manuel:
      /* MS: 19 Aug 2008, we don't have to close fd */
      /* since it will be closed automatically with */
      /* SOCKET( sock ).input                       */
I don' understand the comment because the C shutdown
call comes before any hooks or similar.

In my code, I use this pattern:
(socket-close s)
(socket-shutdown s)

Ciao
Sven
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.