Skip navigation

JSI Tip 1916. How can I close a NetBIOS session after the program using it finishes?

Unused NetBIOS sessions are disconnected after 15 minutes of inactivity.

If your program measures licenses by counting connections, you would want to end the session ASAP, or you may just want to free the resource. Unfortuneatly, there is no standard method.

You can use a batch file to initiate the NetBIOS session, run the program, and then terminate the NetBIOS session:

net use <drive:> \\computername\sharename
<drive:>\folder\ProgramName.exe
Sleep x
net use <drive:> /delete

NOTE: Sleep x (seconds) allows time for the program close to be committed.

NOTE: The server doesn't release the connection for an additional 255 seconds.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish