FTP PORT command
By lucb1e on 2011-12-06 21:34:54 +0100
A while ago I searched for it quite a bit but couldn't really figure out how to understand the PORT command, visible in Filezilla FTP:
PORT 83, 161, 210, 237, 5, 7
The first four parameters are obvious to me, it is my external IP address. But then the last two... They turn out to be the port which is used (Commandname, anyone? :P)
, but how does it know what port to use now?
After Googling a lot I found out that both numbers are 8-bit integers and together they can make up the 16 bit port value. Sounds logic, 2 times 8 bits is 16 bits. But except for converting them both to binary and putting them together, I didn't know how to convert it. When you think about it afterwards, it's quite logic.
Try counting up with 2x8bits of space available:
The first number jumps to 1 after
counting to 255 because 8 bits can only hold 0 through 255, so we know that every number on the left is worth 256. Now it's easy to understand the above example command. Multiply 5 by 256 and you get 1280, then add the 7 to get to the final result of 1287.
This is your captain speaking, we have arrived at gate 1287. Welcome to 184.108.40.206.