Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with socket connection

807606Apr 8 2007 — edited Apr 9 2007
One of my assignments was to create a serial I/O device simulator. I've found bits and pieces of code that should work correctly, but for some reason I'm getting a connection refused exception. Here is the while error:
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:366)
        at java.net.Socket.connect(Socket.java:519)
        at java.net.Socket.connect(Socket.java:469)
        at java.net.Socket.<init>(Socket.java:366)
        at java.net.Socket.<init>(Socket.java:179)
        at Driver.connect(Driver.java:20)
        at SocketUser.run(SocketUser.java:33)
Line 20 of Driver.java is:
            socket = new Socket("localhost", 54321);
Line 33 of SocketUser.java is:
connect();
I could post the entire code, but its 6 files big. I tried using a different port, but I still get the error.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2007
Added on Apr 8 2007
8 comments
398 views