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 3 of 3

Thread: java.net.SocketException: Connection reset

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default java.net.SocketException: Connection reset

    I'm getting the following error when attempting to run an applet on a server in a browser:
    java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at sun.net.ftp.impl.FtpClient.readServerResponse(Unkn own Source)
    at sun.net.ftp.impl.FtpClient.readReply(Unknown Source)
    at sun.net.ftp.impl.FtpClient.issueCommand(Unknown Source)
    at sun.net.ftp.impl.FtpClient.issueCommandCheck(Unkno wn Source)
    at sun.net.ftp.impl.FtpClient.openPassiveDataConnecti on(Unknown Source)
    at sun.net.ftp.impl.FtpClient.openDataConnection(Unkn own Source)
    at sun.net.ftp.impl.FtpClient.getFileStream(Unknown Source)
    at sun.net.http://www.protocol.ftp.FtpURLConnec...Stream(Unknown Source)
    at airline.Connection.HttpCommunication.testMethod(Ht tpCommunication.java:62)
    at airline.Connection.HttpCommunication.readCompanyNa meList(HttpCommunication.java:93)
    at airline.UserApplet.AirlineGameApplet$1.run(Airline GameApplet.java:116)
    at java.lang.Thread.run(Unknown Source)
    The applet is signed. The code in question where the exception is being thrown is:
    BufferedReader in = null;
    try{
         URL airportURL = new URL(WEBSITE_FTP+"/companies");
         URLConnection aurlconn = airportURL.openConnection();
         in = new BufferedReader(new InputStreamReader(aurlconn.getInputStream())); //Exception thrown here

    This exception does NOT get thrown while running the applet from the applet viewer in Eclipse. Anyone know of any reasons this would be happening? Any help is greatly appreciated.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: java.net.SocketException: Connection reset

    This issue has been resolved, but I feel I should say something for everyone else who may have this issue:
    There is currently a bug in Java 7 where it doesn't always play nice with the Windows firewall. (Bug ticket: http://bugs.sun.com/bugdatabase/view...bug_id=7077696)
    To resolve this issue, the client needs to run their Command Prompt in Administrator mode, and type the command:
    netsh advfirewall set global StatefulFTP disable
    This should prevent the instance of java.net.Socket from prematurely closing its connection.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  3. #3
    Junior Member
    Join Date
    Jan 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Re: java.net.SocketException: Connection reset

    I tried to put this command in cmd. but i am still getting notification saying "The requested operation requires elevation (Run as administrator)" in command prompt. So What exactly i need to do now? please help me with this one.

Similar Threads

  1. Shared connection or individual connection?
    By newbie14 in forum Java Networking
    Replies: 6
    Last Post: January 12th, 2013, 04:10 AM
  2. Replies: 0
    Last Post: March 26th, 2011, 11:07 AM
  3. Java and db2 connection issue
    By sukhpal48806 in forum JDBC & Databases
    Replies: 2
    Last Post: March 1st, 2011, 12:07 PM
  4. Replies: 0
    Last Post: December 18th, 2010, 08:08 AM
  5. Java - URL connection accessing Java Scrpit Function
    By virtual void in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 7th, 2010, 11:38 AM