I am new to TCP and trying to wrap my head around it. I understand the basics, e.g. the three-way handshake to establish a connection, followed by application-to-application commands.
My question is: When does the client indicate to the server which application it wants to communicate with. Let's say a server is listening on port 80 for HTTP connections, and I try to ftp into port 80. Is it:
1st) Client sends SYN request to server, which responds to with SYN-ACK. Client responds with SYN, connection established.
2nd) Client sends "retrieve ftp://joe.com/file" command to server.
3rd) Server says "I dont have ftp server application, error." Connection terminated and error on client side.
Or, is the desired application/protocol somehow communicated prior to the threeway handshake and the establishment of a connection?