I believe slarty is correct ( I think he usually is )

port numbers are made up of 16 bits

1111111111111111 in binary is 65535 in dec.

In addition to the RFCs you can read up on it in IBM's RedBook

TCP/IP Tutorial and Technical Overview

not for the faint of heart