Stop sending or receiving data on the socket.
Syntax
object.Shutdown( [Option] )
Parameters
- Option
- An optional integer value that specifies the action to be taken.
It may be one of the following values:
Value |
Constant |
Description |
0 |
swShutdownRead |
Disable reception of data. The application will no longer be
able to receive data from the remote host. The application may
continue to send data using the Write or WriteLine
method until the socket is closed. |
1 |
swShutdownWrite |
Disable transmission of data. The application will no longer
be able to send data to the remote host and the remote host will
consider the socket connection to be closed. The application may
continue to read any remaining data in the socket's receive
buffer using the Read or ReadLine method until the
socket is closed. This is the default value if this parameter is
omitted. |
2 |
swShutdownBoth |
Disable both reception and transmission of data. If this
value is specified, then the socket handle remains valid,
however the client will not be able to send or receive data. The
application must call the Disconnect method to close the
socket. |
Return Value
A value of zero is returned if the request was successful.
Otherwise, a non-zero error code is returned which indicates the
cause of the failure.
Remarks
In some asynchronous applications, it may be desirable for a
client to inform the server that no further communication is wanted,
while allowing the client to read any residual data that may reside
in internal buffers on the client side. Shutdown accomplishes
this because the socket handle is still valid after it has been
called, although some or all communication with the remote host has
ceased.
See Also
Disconnect Method
|