Knock Knock Server
client, java, port, sockets
Solution
That tutorial says:
When you successfully get a connection between the client and server, you will see the following text displayed on your screen:
Server: Knock! Knock!
So it's actually the client that initiates the protocol (in network terms) but the server that initiates the joke (in conversational terms). Which I agree is rather confusing.
It might help if you think of it as a Joke Server - in order to get a joke, you have to ask for one! If it was the other way round, you'd have a server that just listens to jokes, which isn't as useful (unless you have absolutely no friends).
Problem
According to this website, http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html it says this : Server: "Knock knock!" Client: "Who's there?" Server: "Dexter." Client: "Dexter who?" Server: "Dexter halls with boughs of holly." Client: "Groan." I thought that if the server is listening on a port that it is waiting for a knock, so the client would be knocking and the server would be saying who's there. I've checked other websites as well and have seen the same client/server responses. Can someone please explain why this is not the case?