NetworkSemaphore Class |
Namespace: com.softwarekey.Client.Licensing.Network
The NetworkSemaphore type exposes the following members.
Name | Description | |
---|---|---|
![]() | NetworkSemaphore | Creates a new NetworkSemaphore object. |
Name | Description | |
---|---|---|
![]() | CleanupThreadInterval | Gets or sets how frequently, in seconds, the cleanup thread tries to delete each semaphore file. The default is 10 seconds. |
![]() | IsValid | Gets whether or not the network session is still valid. |
![]() | LastError | Gets the last error that occurred. |
![]() | SeatsActive | Gets the number of concurrent users. |
![]() | SeatsAvailable | Gets the number of remaining seats available. |
![]() | SeatsTotal | Gets or sets the number of allowed concurrent users. |
![]() | SemaphoreName | Gets the name of the open semaphore file. Returns an empty string if no semaphore file is open. |
![]() | SemaphorePath | Gets or sets the absolute path of the directory used to house the semaphore files. |
![]() | SemaphorePrefix | Gets or sets the prefix used when creating semaphore files. |
![]() | ValidationThreadInterval | Gets or sets how frequently, in seconds, the validation thread checks that the network session is still valid. |
Name | Description | |
---|---|---|
![]() | CancelSearch | Cancels the search in progress. |
![]() | Close | Closes an open network semaphore file. |
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | Open | Opens a network semaphore file. |
![]() | Search | Performs an asynchronous search for an unused network semaphore file. Requires handling the SearchCompleted and optionally the SearchProgress events. |
![]() | ToString | (Inherited from Object.) |
Name | Description | |
---|---|---|
![]() | Invalid | Occurs when the network session is no longer valid. |
![]() | SearchCompleted | Occurs when the search for an unused seat/semaphore file has been completed. |
![]() | SearchProgress | 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 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. |