Socket to localhost

I try to connect to a port on my local NT workstation with this code :

    import java.net.Socket;
    ...
    private Socket s ;
    ...
    try {
            s = new Socket( "localhost" , 6666 );
        }
        catch  (IOExceptions e){
            System.out.println( e.getMessage());
            e.printStackTrace();
        }

It always ends like this :
Connection refused
java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:282)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:124)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:111)
    at java.net.Socket.<init>(Socket.java:221)
    at java.net.Socket.<init>(Socket.java:89)
    at ClientSocket.<init>(ClientSocket.java:34)
    at AWTAppletEditor.GetAppletParams(AWTAppletEditor.java:281)
    at AWTAppletEditor.init(AWTAppletEditor.java:160)
    at sun.applet.AppletPanel.run(AppletPanel.java:281)
    at java.lang.Thread.run(Thread.java:466)

Do I have some special service to configure on my workstation or what's wrong ?
Eric98Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rainmalCommented:
Well check to see that there is a server socket listening on 6666.
This error generally occurs if the socket cannot bind to the specified port.In other words check the server.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rainmalCommented:
try using "127.0.0.1" instead of  localhost...but I don't think there should be any problem there.
0
rainmalCommented:
To see is you have the server up try running a telnet on

hostname : 127.0.0.1
port          : 6666

0
Eric98Author Commented:
You are right, the port listener wasn't launched on my local workstation
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.