Thetype exposes the following members.
Gets or sets how frequently, in seconds, the cleanup thread tries to delete each semaphore file. The default is 10 seconds.
Gets whether or not the network session is still valid.
Gets the last error that occurred.
Gets the number of concurrent users.
Gets the number of remaining seats available.
Gets or sets the number of allowed concurrent users.
Gets the name of the open semaphore file. Returns an empty string if no semaphore file is open.
Gets or sets the absolute path of the directory used to house the semaphore files.
Gets or sets the prefix used when creating semaphore files.
Gets or sets how frequently, in seconds, the validation thread checks that the network session is still valid.
Cancels the search in progress.
Closes an open network semaphore file.
|Equals||(Inherited from Object.)|
|Finalize||(Inherited from Object.)|
|GetHashCode||(Inherited from Object.)|
|GetType||(Inherited from Object.)|
|MemberwiseClone||(Inherited from Object.)|
Opens a network semaphore file.
|ToString||(Inherited from Object.)|
Occurs when the network session is no longer valid.
Occurs when the search for an unused seat/semaphore file has been completed.
Occurs when progress is made in searching for an unused seat/semaphore file. The SearchProgress event may be used by your application to keep a user informed of the progress being made while searching through semaphore files.
A Network Semaphore File is a file, which contains no useful data, stored on a common network directory used to assist in enforcing a Network Floating License in an application. One file is created and locked exclusively for each active workstation or instance of your protected application. Other LAN users attempting to run the application will not be able to use any semaphore files that are locked, which is how this can enforce license compliance which limits the number of network "seats."
Any users who will use an application using this type of licensing will need access to read, write, modify, and delete the semaphore files.
This functionality is supported on environments where semaphore files are hosted on a Windows (SMB/CIFS) share, which functions best on a Local Area Network (LAN). While this may be used in a Wide Area Network (WAN) environment (which includes scenarios where a user access a given "LAN" over a Virtual Private Network [VPN] connection), it is strongly advised testing is done before deploying to any given WAN environment. This is because the performance of this feature is centered around that of the Windows (SMB/CIFS) shares being used to host the semaphore files (and WAN/VPN environments can see much slower performance than a typical LAN configuration).
The NetworkSemaphore class is only supported when the system hosting the Windows (SMB/CIFS) share which houses the semaphore files, and the clients which access the share, all run Windows Vista/Windows Server 2008 or later.
The NetworkSemaphore class is not available in the .NET Standard PLUSManaged assembly.
The computer hosting the Windows (SMB/CIFS) share (the server) which houses the semaphore files is ultimately responsible for handling when a file is unlocked. In most cases, applications which are terminated gracefully will unlock and delete their semaphore files. If the application crashes, however, the server will eventually unlock the semaphore file, but it will not delete the file. Having many of these files present can lead to some performance degradation, as each of these orphaned files can take a while to try to lock or delete. For this reason, the NetworkSemaphore constructor has a "runCleanupThread" argument, which may be set to true to have active processes try to delete orphaned files quietly, in the background. Of course, this will increase the amount of bandwidth used, but can help increase performance keeping the share location clear of any orphaned files.