ClearConnectionNumber
Clears a logical connection from the server (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWClearConnectionNumber)
#include <nlm\nit\nwenvrn.h>
int ClearConnectionNumber (
WORD connectionNumber);
The first time a workstation attaches to a server, the server assigns it the first unused connection number in the File Server Connection Table. When a workstation detaches from a server, the server marks its connection number unused but reserves it in anticipation of reattachment. A reserved logical connection number is not reassigned to another workstation until it is the first unused connection number and the attaching workstation does not have a connection number reserved.
The server has room for 250 logical connections. The File Server Connection Table maintains the addresses of the workstations attached to the server.
This function blocks when successful.
This function closes a connection’s open files and releases a connection’s file locks. On a TTS server, this function causes a connection’s transactions to be aborted.
When a requesting workstation clears its own connection, it can no longer communicate with the server.
The requesting workstation must have security equivalence to Supervisor rights.
#include <stdio.h>
#include <nlm\nit\nwenvrn.h>
main()
{
int ccode;
WORD connectionNumber;
printf ("\n\n");
printf ("Enter connection number to be cleared: ");
scanf ("%u", &connectionNumber);
ccode = ClearConnectionNumber (connectionNumber);
if (ccode == 198)
printf ("\n\nNO CONSOLE RIGHTS\n");
else if (ccode == 0)
printf ("\n\nSUCCESSFULLY cleared connection number. %u\n",
connectionNumber);
else
printf ("\nccode = %d\n", ccode);
}