Servers and the command line…

by Sue

My server would not run for the ATM simulator homework I was editing this weekend, so I sent it to Dave to see what was wrong. He said it worked for him and declared “Y U NO WRITE CODE THAT IS BROKEN?”

So I tried it again, and again, I got the dreaded error:

An exception occurred while communicating with the ATM
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:433)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:477)
at java.net.Socket.(Socket.java:374)
at java.net.Socket.(Socket.java:187)
at cscie160.hw6.ATMProxy.(ATMProxy.java:19)
at cscie160.hw6.Client.main(Client.java:12)

About here I am seriously losing my mind and falling deeper into a pit of despair and insanity. Why the hell does my server not work?

Today, Dave comes in and I learn about Telnet. THIS WORKS:

Go to the “bin” folder of my java project and start my server.

java cscie160.hw6.Server 7777

Then after it declares “Accepting clients” hit COMMAND+t (I am on a mac) and type in:

telnet localhost 7777

Rejoice as I finally see:

Trying 127.0.0.1...
Connected to localhost.

Thank. Freaking. God. My ATM works fine now.