U have to learn port numbers of only some common protocols like HTTP,FTP,SMTP,UDP , TELNET , DNS ,POP .So not a big deal in my opinion.
Also if you are talking about classification of ports in general ,there are 3 types of ports :
a) Predefined ports (also known as universal ports or fixed ports) : Having port number 0 to 1023 e.g. HTTP : 80 , FTP : 20,21
b) Registered ports : Having port number ranging from 1024 to 49151
c) Dynamic Ports (or epemeral ports) : Having port nos from 49152 to 65535
Maximum possible port no = 65535 since we have 16 bits specified for a port number.
Now we have to remember 2 points :
a) If the source port is a fixed port(e.g. HTTP server having port no 80) and destination port is a dynamic port , then the data is moving from server to client.
b) If the source port is a dynamic port and destination port is a fixed port (e.g. HTTP server port having port no 80 or an FTP port) , then the data is moving from client to server .
Keeping in mind the above points , the header information of TCP or UDP can be given and can be asked if the data is moving from server to client or vice versa.
I hope these points will be useful to all.