I have a few questions in regard to the following explanation of ports I found.
The Application layer talks to the Transport layer through a port. Ports are numbered and standard applications always use the same port.
The use of a port number allows the Transport protocol (typically TCP) to know which kind of contents is inside the packet, allowing it to know, at the reception side, to which Application protocol it should deliver the received data.
Why would a port number ever be used to tell what kind of application data protocol resides inside when there's not absolute guarantee?
To my understanding, there are no restrictions to what kind of application data you send over a port (it's just a suggestion). Plus isn't the protocol data already included somewhere in the packet for this purpose?
Also, What happens to the data if you send HTTP or some other kind of protocol to a destination of port 25 (which expects SMTP)?
Third, what happens to the data if you send it to a port that isn't bound with any program, and therefore not being listened to?
**Finally, if a port can only be bound to a single program, how can multiple programs that depend on incoming HTTP data be running on my computer at the same time?****
Thanks in advance!