Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am developing a gaming control panel and that uses Rcon.jar to fetch data from gaming server.

the code to use it written as below

public static String rconExecute(String rcon, String command, int port, String ip) throws SocketTimeoutException{
        String response = "";
        try {

            response = Rcon.send(27778, ip, port, rcon, command);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return response;
    }

this throws an error when run using site but when done using local application like

public class RconTest {

    public static void main(String args[]) throws SocketTimeoutException, BadRcon, ResponseEmpty{
        String response = Rcon.send(27778, "59.177.45.13", 27015, "123", "status");
        System.out.println(response);
    }
}

it works fine any reason why?

the error is :java.net.SocketTimeoutException: Receive timed out

share|improve this question

2 Answers 2

You need to narrow down what might have caused the error. Timeout might mean either it can't reach the server at all, or it can, but the server isn't accepting the connection.

Check everything you're assuming - like the port number, the server IP address, etc. When you find yourself with a, "But it HAS to work!" bug, that usually means you're assuming something that isn't true.

In that vein, note that the call to Rcon.send in the two code examples aren't identical - one has parameters passed in and the other has hardwired parameters. You're assuming the parameters passed (like ip address) are correct. If you replace the Rcon.send line in example 1 with the hardwired one in example 2 does it work?

share|improve this answer
    
no still it didnt worked tried that as well –  Varun May 4 '11 at 4:28
1  
Ouch. Hmm. Is there any record on the server that the request is actually coming in? I guess that's still the central question I have: is it just not even getting to the server, or getting there but not actually connecting? Or is it just some completely unrelated error masked as a connection error? –  Tim Holt May 5 '11 at 21:54

I'm not too familiar with rcon, is it the remote administration protocol from Valve?

If so, is the web server on your machine? What is this IP address, yours? Is it properly routed with the right ports (if you're behind a rounter)? Is your firewall accepting incoming connections on this port from your web server?

If you install a web server on your PC, does the code work? This would mean that your server is most likely only accepting connection from your localhost or that the firewall / router config is preventing external connections.

share|improve this answer
    
yes it is.. i have already told the web server is on my machine the same code works fine from main() and from applets as well but shows issue when sent from a servlet –  Varun Sep 28 '11 at 11:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.