Keep Terminal Services & Remote Desktop From Disconnecting

I have run into many cases where my customers had a hard time with a remote desktop connection to their server disconnecting.
I did all the tweaks needed to make sure terminal services and remote desktop (They are the same) didn't have a timeout limit.
So why on earth was their connections still dropping?

Well after doing some research the problem is the connection being dropped by the isp or router. When a port is in use but no traffic is going across it the connection is dropped after a while.
The fix? To have the remote connection send a keep alive, or heart beat packet.

Now the remote desktop will send data to keep the connection alive. And so far, every customer who had disconnect problems has been fixed :-)

I applied this registry tweak to the server the users where connecting to.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"TcpMaxDataRetransmissions"=dword:00000010

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]
"KeepAliveEnable"=dword:00000001

Enjoy!
-Shane