How do I modify a port?
Modify the server-side port settings and the registry has 2 places to modify. [Hkey_local_machinesystemcurrentcontrolsetcontrolterminal Serverwdsrdpwdtdstcp] The PortNumber value, which defaults to 3389, is modified to the desired port, as you said it would be 6222. Second place: [hkey_local_machinesystemcurrentcontrolsetcontrolterminal serverwinstationsrdp-tcp] portnumber value, default is 3389, Modify to the desired port, the 6222, the restart will be OK. That's it, okay?
Note that you must add the modified port number in the firewall exception if you want to continue using Remote Desktop after your computer has finished modifying the port number and the computer has a firewall enabled. Otherwise, both 3389 and the modified port number will not connect to the Remote Desktop.
Those who use foreign service cannot afford to hurt:
After years of practice, come true, due to the interference of the Greater China Firewall, Remote Desktop Connection to foreign servers, will often cause 3389-port communication is blocked, and other access is normal, including server Web site access (of course, there are intermittent shielding 80-port things happen).
Because I have two servers, most is a normal, the other does not, on the remote to an internal and remote past.
Sometimes it's a wonder when you can't even meet two.
Suddenly came the consciousness:
Recently realized suddenly, since 3389 is the default blocked, then the port has been changed, after the reform, remote smoothly, the mood also let go, the server security also improved.
How to change?
Directly modify the registry, write code are afraid of trouble, online download gadgets use it, write code are afraid of unsafe.
So, anyway, it's simple, brush a few minutes, write your own, the code on a paragraph:
public static void Change (int port)
{
Try
{
RegistryKey Runkey = Registry.LocalMachine.OpenSubKey (@ "systemcurrentcontrolsetcontrolterminal Serverwdsrdpwdtdstcp ", true);
if (Runkey!= null)
{
Runkey.setvalue ("PortNumber", port);
Runkey.close ();
}
Runkey = Registry.LocalMachine.OpenSubKey (@ "Systemcontrolset001controlterminal serverwinstationsrdp-tcp", true); Win7
if (Runkey!= null)
{
Runkey.setvalue ("PortNumber", port);
Runkey.close ();
}
Runkey = Registry.LocalMachine.OpenSubKey (@ "Systemcurrentcontro1setcontroltenninal serverwinstationsrdptcp", true) ;//win2003
if (Runkey!= null)
{
Runkey.setvalue ("PortNumber", port);
Runkey.close ();
}
MessageBox.Show ("Modified successfully, restart the computer after the effective.") ");
}
catch (Exception err)
{
MessageBox.Show (Err. message);
}
}
After tossing the WinForm tool the following figure, a code, mainly to avoid their own delays, modify the code to fill up. com, to strengthen their memory: