System.Net.Socket.TSocket.Accept
Delphi
function Accept(Timeout: Cardinal = INFINITE): TSocket;
C++
TSocket* __fastcall Accept(unsigned Timeout = (unsigned)(0xffffffff));
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Net.Socket.pas System.Net.Socket.hpp |
System.Net.Socket | TSocket |
Description
Blocks the caller of this function until a client connects, and then returns a new instance of Socket.TSocket.
If the specified timeout passes before a client connects, Accept returns nil. Timeout
is a value in milliseconds.
You must call Listen to configure your socket to listen to incoming connection before you can call Accept to accept one of those incoming connections.
The caller becomes the owner of the returned instance of Socket.TSocket. The caller is responsible for destroying the returned socket once it is no longer necessary.
Exceptions
A call to Accept can raise any of the following exceptions:
Exception | Exception.Message | Scenarios |
---|---|---|
Network socket error: <error message> (<error code>), on API 'accept' |
| |
Network socket error: <error message> (<error code>), on API 'select' |
| |
Socket not listening |
|