How to get port in FTP protocol from passive mode?

浪尽此生 提交于 2020-05-24 08:34:39

问题


When I entered passive mode in FTP, I have got:

227 Entering Passive Mode (213,180,204,183,230,205).

First 4 numbers are the IP addresses, but what are the two last?

Are they two ports?


回答1:


the last two are: p1 and p2 from RFC of ftp: http://www.faqs.org/rfcs/rfc959.html

to get port, use:

p1 * 256 + p2, then connect to this port




回答2:


the port number is a 16-bit value between 0 and 65535 due to some constraints the authors have decided that all numbers between commas should be 8-bit (between 0 and 255). Thus, the 16-bit port number is represented with 2 8-bit numbers.

In your case the port number will be 230 * 256 + 205 = 59085



来源:https://stackoverflow.com/questions/9966993/how-to-get-port-in-ftp-protocol-from-passive-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!