0

I am making a game in libdgx and storing a high-score list online in a file. One of my computers is able to access the file online, while the other computer connected to the same router cannot. I tried turning off the firewall but it has not helped. What may be the cause of this problem?

    try {

    URL url = new URL("ftp://.............highscores.txt");

    InputStream in = url.openStream();
    java.util.Scanner s = new java.util.Scanner(in).useDelimiter(" ");
    for(int i=0;i<5;i++)
    {
        scores[i] = s.nextInt();
    }
    for(int i=0;i<5;i++)
    {
        names[i] = s.next();
    }
    }

    catch(java.io.IOException e){}

Here is the stack trace

java.net.SocketException: Permission denied: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at sun.net.ftp.impl.FtpClient.readServerResponse(FtpClient.java:421)
at sun.net.ftp.impl.FtpClient.readReply(FtpClient.java:498)
at sun.net.ftp.impl.FtpClient.issueCommand(FtpClient.java:533)
at sun.net.ftp.impl.FtpClient.issueCommandCheck(FtpClient.java:544)
at sun.net.ftp.impl.FtpClient.openPassiveDataConnection(FtpClient.java:607)
at sun.net.ftp.impl.FtpClient.openDataConnection(FtpClient.java:710)
at sun.net.ftp.impl.FtpClient.getFileStream(FtpClient.java:1284)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:428)
at java.net.URL.openStream(URL.java:1037)
user3014911
  • 169
  • 1
  • 1
  • 6
  • Possible duplicate of http://stackoverflow.com/questions/6990663/java-7-prevents-ftp-transfers-on-windows-vista-and-7-if-firewall-is-on-any-idea – Erwin Bolwidt May 30 '14 at 05:05

1 Answers1

0

This line

catch(java.io.IOException e){}

Means that you are swallowing any exceptions that your code may be throwing.

At a bare minimum, this code should be

catch(java.io.IOException e)
{
  e.printStackTrace();
}

But preferably, you should be using a logging framework and logging it out.

Once you have the logs, update your question. Otherwise, there isn't much to go on.

Catchwa
  • 5,845
  • 4
  • 31
  • 57