What should be the FTP response to PASV command

BackSlash picture BackSlash · Jan 24, 2013 · Viewed 10k times · Source

i'm writing an FTP server, but i don't understand the PASV command, any server sends a response like this:

227 Entering Passive Mode (213,229,112,130,216,4)

what does the numbers in brackets mean? And whats the difference between normal and passive mode?

Answer

inherithandle picture inherithandle · Jan 26, 2013

Yes, you've got (213,229,112,130,216,4) as a result. 213,229,112,130 is IP address. 216 is upper 8bits in decimal. 4 is lower 8bits in decimal. So port number is 216 * 256 + 4. You should parse them in bracket.