February 23rd, 2011

How long does an idle UNC connection remain active before it is automatically disconnected?

When you access a resource via a UNC, the Windows network redirector keeps the virtual circuit open for a while even after you close the resource. This is done to take advantage of locality: If you access a network resource once, you’re probably going to access it again in a short time, so the redirector leaves the connection open for a little bit, on the off chance that you’re going to use it again. For example, if copying a bunch of files from a server via a UNC, once one file copy is complete, the next one is going to start very shortly thereafter. If there is no activity on a connection for a while, then the redirector decides, “Okay, well, I guess that’s all there is for that” and closes the connection.

The default duration for this “UNC grace period” is ten minutes. You can customize it by setting the KeepConn parameter. Increasing the value will keep the connection active longer, which is a greater convenience for the client, but it also increases the load on the server.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.