System.Net.Socket.TSocket.Close

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Close; overload; inline;
procedure Close(ForceClosed: Boolean); overload;

C++

void __fastcall Close()/* overload */;
void __fastcall Close(bool ForceClosed)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Net.Socket.pas
System.Net.Socket.hpp
System.Net.Socket TSocket

Description

Shuts down the communications channel.

If ForceClosed is True, Close performs an immediate and possibly dangerous shutdown of the communications channel. If ForceClosed is False or not specified, Close performs a safe shutdown of the communications channel.

Exceptions

A call to Close can raise any of the following exceptions:

Exception Exception.Message Scenarios

ESocketError

Network socket error: <error message> (<error code>), on API 'closesocket'

Network socket error: <error message> (<error code>), on API 'shutdown'

Socket already closed

  • You have tried to close a socket that had been already closed.