mnEnableGracefulDisconnect

This command makes graceful disconnecting possible.

This command should be used before initializing an instance in server state (mnStartServer) or client state (mnConnect).

By default graceful disconnect is disabled.

When graceful disconnect is enabled mnClientConnected can return 2, 3 or 4 (what these mean is explained in mnClientConnected) and mnShutdownClient can be used.

The graceful disconnect procedure operates as follows. In this case the server begins the procedure, but the client could also begin the procedure:

1. Server uses mnShutdownClient on a client. Graceful disconnect procedure has begun. No more sending to this client can take place. All data that has been sent before now will be received by the client.

2. Client receives all data sent by server.

3. Client sends final data and uses mnShutdownClient. Client is now full disconnected and can cleanup using mnFinish.

4. Server receives all data sent by client and can now cleanup using mnDisconnectClient.

See demo code in folder Graceful Disconnect.

Parameters

int Instance: This is the instance that the command should use.

Returns (Integer)

0 if no error occurred.

-1 if an error occurred.

Present in

DBP

C++

.Net




This page is in the following sections:
(2) Networking Commands
(1) Networking
(0) DarkNet Help