Generic FunctionPackage: socketToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


Arguments: sock &key direction

sock is a socket currently connected to another socket. The value of the direction must be specified either :input or :output. Note that direction defaults to nil which is not a legal value. shutdown will signal an error if direction is not specified either :input or :output.

shutdown closes down the specified half of the bidirectional socket connection. It does not force out unflushed buffers first (as the close function does).

Calling shutdown on a socket twice, once for :input and once for :output will cause the operating system file descriptor associated with the socket to be closed. Thus you need not call the Lisp function close. Note it is not an error to call close; it will just do nothing.

This function is useful in many socket applications.

For example:

(setq sock (make-socket :remote-host "foo" :remote-port 1234))
(format sock "are you ok?~%")
(force-output sock)
(shutdown sock :direction :output)

(read sock)

Calling shutdown in the above example causes the program at the other end of the connection to receive an End of File indication. Some programs, when they receive an End of File, formulate and send a reply back down the socket. Using shutdown rather than close allows this reply to be read.

See socket.htm for general information on sockets in Allegro CL.

Copyright (c) 1998-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2017.2.15.

Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version