Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: java.net.connectexception connection refused connect

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java.net.connectexception connection refused connect

    try
    {
    Socket client = new Socket("127.0.0.1",11020);
     
    input = new BufferedReader(new InputStreamReader(client.getInputStream()));
    output = new PrintWriter(client.getOutputStream(),true);
    ois = new ObjectInputStream(client.getInputStream());
    }
     
    catch(Exception e){
     
    javax.swing.JOptionPane.showMessageDialog(null,"Ex ception "+e,"Error!!",javax.swing.JOptionPane.ERROR_MESSAG E);
    System.exit(0);
    }

    when i try running this simple code it gives out an error

    java.net.connectexception connection refused connect

    in the dialogbox i created.

    i tried many solution, disabling firewall, manually opening port 11020. but none seems to wrk for me. please help me guys.

    OS: 64bit win 7 ultimate.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,237
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: java.net.connectexception connection refused connect


  3. #3
    Junior Member
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java.net.connectexception connection refused connect

    take my word for not posting same question on multiple forums but i'm in a real mess here!

    please provide the solution.

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: java.net.connectexception connection refused connect

    Can you post all of your code please?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    12
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Re: java.net.connectexception connection refused connect

    Quote Originally Posted by gagangujral View Post
    try
    {
    Socket client = new Socket("127.0.0.1",11020);
     
    input = new BufferedReader(new InputStreamReader(client.getInputStream()));
    output = new PrintWriter(client.getOutputStream(),true);
    ois = new ObjectInputStream(client.getInputStream());
    }
     
    catch(Exception e){
     
    javax.swing.JOptionPane.showMessageDialog(null,"Ex ception "+e,"Error!!",javax.swing.JOptionPane.ERROR_MESSAG E);
    System.exit(0);
    }

    when i try running this simple code it gives out an error

    java.net.connectexception connection refused connect

    in the dialogbox i created.

    i tried many solution, disabling firewall, manually opening port 11020. but none seems to wrk for me. please help me guys.

    OS: 64bit win 7 ultimate.
    Judging from the code that was posted, and not knowing any of the other code, I would have to say that there's no service running on port 11020.

  6. The Following User Says Thank You to Zymus For This Useful Post:

    Json (May 6th, 2011)

Similar Threads

  1. Java Code to connect remote server
    By idealguy in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 3rd, 2012, 04:59 AM
  2. Replies: 0
    Last Post: March 26th, 2011, 11:07 AM
  3. connect java to a database
    By ridg18 in forum JDBC & Databases
    Replies: 1
    Last Post: December 25th, 2010, 10:28 AM
  4. Connection refused: connect
    By kirts in forum Java Networking
    Replies: 0
    Last Post: April 16th, 2010, 11:53 AM
  5. how can i connect with a dial up connection
    By reguapo in forum Java Networking
    Replies: 1
    Last Post: February 2nd, 2010, 05:21 AM