I'm having trouble with the "DailyAdviceClient" example in Head First chapter 15.
I've typed in the example as shown below:
When I run this I get the following exception:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Metho
Obviously my socket connection has been refused.
Why is this?
Have I coded this incorrectly?
Is this server no longer valid? - after all the book was written a few years back.
I've had a quick Google and a search on JavaRanch and found no relevant references. I'd appreciate any inputs.
Regards and thanks.
Do you have a server program running before you execute the client?
And is the server listening on the same port where the client is connecting to?
Hope this helps
[ August 22, 2008: Message edited by: Amit Ghorpade ]
That's a very good point!
I had just typed in the code from the book assuming it was connecting to some server or other. Of course "127.0.0.1" is local host, so no I don't have any server program running! What a twit I am.
In the preceding text of the book they use "18.104.22.168" so I tried that and it just times out. So either this was just an example that they didn't expect anyone to run, i.e. this "Advice Guy" service doesn't exist or it now no longer exists.
Thanks for your help.
I have just read a bit further through the book and they've gone through the server code that's needed to make this work a few pages later!
I guess I was too keen to get it coded and should have read the next few pages before getting going, what a larf ......