Can the number of ports exceed 65535?

Source: Internet
Author: User

Title: Who changed the terminal to a high port ?, Author: ddoop.

Hit a server with a stick ~ Port 3389 is changed to 78650

Generally, the ports on the server are 1-65535, and the port number is 78650... The situation is as follows:


I cannot connect to the desktop. What's strange is that ~~ When querying the user, we found the following:


You can't blame it... After the port is changed back, the pressure is gone ~ Why can't I connect ~~ He can connect to it?

The related information is as follows:

I have heard of this problem for the first time. After reading the relevant information, I learned:

Let's see what the experts have told you:

Haha whether the tcp port size is 16 bit can exceed 65535 !!

However, Windows may have a problem: telnet www.sina.com.cn 65616. You can test it!

This is actually accessing port 80 of www.sina.com.cn. Why? If you cannot find out, go back to school and study again!

Note: 65616-65536 = 80

The following is a reference clip:

Main ()
{
Unsigned short int tcp_port = 65616;
Printf ("% u", tcp_port );
}

 

Some software, for example, Windows telnet, may use a 32-bit Data Type record port, so that the port can be seen to exceed 65535.

However, tcp header clearly defines the tcpport as 16 bit. Even if some applications use a 32 bit data type, the final result is forcibly converted.

Simply put, it is:

1. You can use 4 or more bytes in the application to store the port number.

2. After the system's TCP/IP communication is called, the system's underlying layer forcibly switches the port over 65536 back to the normal range.

3. During the conversion process, no error information will be returned, and everything is quietly carried out. Therefore, the application layer program will not respond to any special response, and all this is done quietly at the underlying system level.

4. The conversion method is: port number-65536 = ?, The question mark is the conversion result.

5. What if the converted port exceeds 65535? Then continue the conversion until the value is less than or equal to 65535. Therefore, telnet www.baidu.com 131152 can be executed perfectly (65536 + 65536 + 80 = 131152 ).

Related Article

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.