Debugging tips--windows Port number is occupied

Source: Internet
Author: User
Tags exit in

Debugging tips Whether the port number is occupied by the--windows ports concept

10.0.0.0~10.255.255.255,172.16.0.0~172.16.255.255, 192.168.0.0~192.168.255.255.
Port concept
In network technology, the port has roughly two meanings: the first is the physical port, for example, ADSL Modem, hub, switch, router interface for connecting other network devices, such as RJ-45 Port, SC port and so on. The second is the logical port, generally refers to the TCP/IP protocol port, the range of port number from 0 to 65535, such as for browsing the Web services 80 port, for the FTP service 21 port and so on.

What we're going to introduce here is the logical port.
(1) Well-known port (well-known Ports)
Well-known ports, known as port numbers, range from 0 to 1023, and these port numbers are generally fixed to some services. For example, 21 ports are assigned to the FTP service, 25 ports are assigned to the SMTP (Simple Mail Transfer Protocol) service, 80 ports are assigned to the HTTP service, 135 ports are assigned to the RPC (Remote Procedure Call) service, and so on.

(2) dynamic port (Ports)
Dynamic ports range from 1024 to 65535, and these port numbers are typically not fixed to a service, which means that many services can use these ports. As long as the running program makes a request to the system to access the network, the system can allocate one from these port numbers for the program to use. For example, port 1024 is assigned to the first program to send a request to the system. When the program process is closed, the occupied port number is freed

Port mappings
Port mapping is often referred to as a NAT address translation, its function is to translate the address in the public network to a private address, the use of a route ADSL broadband router has a dynamic or fixed public network IP,ADSL directly connected to the hub or switch, all the computer sharing Internet.

Second, see if the Windows port is open

Using the Telnet command

On the command line, run the Telnet IP address port number

C:\users\yankan>telnet-char][-f log file][-l user][-t term][host [Port]]-a      attempts to log on automatically. The same as the-l option in addition to the currently logged in user name. -e      skips characters to enter the Telnet client prompt. -F client logon filename-l Specify the user name to log on to the remote system. Requires the remote system to support the TELNET ENVIRON option. -t specifies the terminal type. The supported terminal types are: VT100, VT52, ANSI, and VTNT. host specifies the hostname or IP address of the remote computer to which you want to connect. PORT Specifies the port number or service name. 

Use the Telnet IP address port number method to test whether the port is open.

Connection failed:

c:\users\yankan>telnet 10.1.37.214 9999 connecting 10.1.37.214 ... The connection to the host could not be opened. On port 9999: Connection failed

Connection successful, jump to Telnet screen or prompt connection success

Turn on the Telnet service

If you use the Telnet command to prompt that this command does not exist, you need to turn on

1, installation system: Click "Start" → "Control Panel" → "Programs", "in programs and features" to find and click "Turn Windows features on or off" into the Windows Feature Settings dialog box. Locate and tick "Telnet client" and "Telnet Server", and finally "OK" to complete the installation at a later moment.
2, start the service: in Windows 7 system "Start" → "Run", enter Servcies.msc Open Service Manager. Locate and double-click the Telnet service entry, set it to start manually (more secure, only when needed), and finally "start" the service "OK" to exit in the system.

Third, check whether the Windows port number is occupied, and open the shutdown port

Windows platform

Execute under Windows command-line window: Netstat-ano
We can know that a certain port is occupied by that process (corresponding to PID);
Then we can open the Task Manager and view a PID corresponding to the process name;
If the PID is not displayed, the menu "View" Select the column "PID can be selected;"
Once we know the process, we can kill the process and modify the port it uses.

Continue to execute the following command:

Netstat-aon|findstr "127.0.0.1:80" TCP 0.0.0.0:0 LISTENING 200

See, Port is occupied by process number 2016 process, continue to execute the following command:

"$",064 K   

It's clear that Skype.exe is taking up your port.


Netstat command
Command format:

NETSTAT [-A] [-b] [-e] [-n] [-O] [-P proto] [-r] [-S] [-v] [interval]

-a displays all connections and listening ports.

-B Displays the executable components that are included in creating each connection or listening port. In some cases, the executable component is known to have multiple independent components, and in these cases a sequence of components that are included in creating a connection or listening port is displayed. In this case, the executable component name is in the bottom [], the top is the component it calls, and so on, until the TCP/IP section. Note This option may take a long time and may fail if insufficient permissions are available.

-e Displays Ethernet statistics. This option can be used in combination with the-s option.

-N Displays the address and port number in digital form.
-O Displays the owning process ID associated with each connection.
-p proto shows the connection to the protocol specified by proto; Proto can be one of the following protocols: TCP, UDP, TCPv6, or UDPV6.
If used with the-s option to display per-protocol statistics, Proto can be one of the following protocols:
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPV6.

-r Displays the routing table.
-S displays statistical information by protocol. By default, the display IP,
IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPV6 statistics;
The-p option specifies a subset of the default conditions.

The-V is used with the-B option to display components that are included in creating a connection or listening port for all executable components.

Interval re-displays the selected statistics, pausing the interval (in seconds) between each display. Press CTRL + C to stop displaying the statistics again. If omitted, netstat displays the current configuration information (only once)

Iv. process

1. View process Information

Tasklist

Effect:

2, query all processes corresponding system services

Tasklist/svc

3. View all the associated module information, such as DLLs

tasklist/m

You can follow the name of the specific DLL to see which services are used by this DLL

4, according to the process ID view the detailed information

tasklist/"pid eq 4284"  

Effect

5. Kill process based on process ID

6636-f

/PID represents the process ID, and-F is forced to close.

6. Kill the process according to the name

Taskkill/im notepad.exe-f

Debugging tips--windows Port number is occupied

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.