koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
356 stars 67 forks source link

SourceServer for garry's mod always throws a TimeoutException. #285

Closed zack6849 closed 8 years ago

zack6849 commented 8 years ago

Hello, it would appear doing anything to do with players breaks steam condenser for java and throws a TimeoutException.

Example code

/**
 * Created by zack6849 on 12/6/2015.
 */

import com.github.koraktor.steamcondenser.exceptions.SteamCondenserException;
import com.github.koraktor.steamcondenser.steam.SteamPlayer;
import com.github.koraktor.steamcondenser.steam.servers.SourceServer;

import java.util.Map;
import java.util.concurrent.TimeoutException;

public class Main {
    public static void main(String[] args) throws TimeoutException {
        try {
            SourceServer server = new SourceServer("198.245.63.75", 27015);
            server.initialize();
            for(Map.Entry<String, SteamPlayer> player : server.getPlayers("notarealpasswordlol").entrySet()){
                System.out.println(player.getKey());
            }
        } catch (SteamCondenserException e) {
            e.printStackTrace();
        }
    }
}

Output:

Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.QuerySocket send
INFO: Sending data packet of type "A2S_INFO_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.SourceSocket getReply
INFO: Received reply of type "S2A_INFO2_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.QuerySocket send
INFO: Sending data packet of type "A2S_INFO_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.SourceSocket getReply
INFO: Received reply of type "S2A_INFO2_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.QuerySocket send
INFO: Sending data packet of type "A2S_PLAYER_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.SourceSocket getReply
INFO: Received reply of type "S2C_CHALLENGE_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.QuerySocket send
INFO: Sending data packet of type "A2S_PLAYER_Packet"
Dec 06, 2015 4:03:00 AM com.github.koraktor.steamcondenser.steam.sockets.SourceSocket getReply
INFO: Received reply of type "S2A_PLAYER_Packet"
Exception in thread "main" java.util.concurrent.TimeoutException
    at com.github.koraktor.steamcondenser.steam.sockets.SteamSocket.receivePacket(SteamSocket.java:112)
    at com.github.koraktor.steamcondenser.steam.sockets.RCONSocket.getReply(RCONSocket.java:99)
    at com.github.koraktor.steamcondenser.steam.servers.SourceServer.rconAuth(SourceServer.java:148)
    at com.github.koraktor.steamcondenser.steam.servers.GameServer.updatePlayers(GameServer.java:535)
    at com.github.koraktor.steamcondenser.steam.servers.GameServer.getPlayers(GameServer.java:205)
    at Main.main(Main.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
koraktor commented 8 years ago

What happens when using getPlayers() without the password argument?

zack6849 commented 8 years ago

No error, however literally anything with rcon seems to do this.

Rcon exec, rcon auth, etc

koraktor commented 8 years ago

Does RCON work with other tools? Is RCON listening on a different port or blocked by a firewall?

zack6849 commented 8 years ago

It works fine if i rcon from tf2, no it isn't on a different port or blocked by a firewall

Edit: it doesn't work from garry's mod, i get an error, maybe it is a firewall? let me look into this further, i'd assumed that couldn't have been the case.

Edit: that's fucking weird, my garry's mod server randomly stopped working with rcon, it works totally fine on a different port, i guess my issue is invalid

koraktor commented 8 years ago

Thanks for the update, though.

zack6849 commented 8 years ago

No problem, im wondering wtf it is though, i dont see any reason garry's mod would randomly break rcon, especially with a useless error like Lost RCON connection, please retry command (UNKNOWN ERROR)

zack6849 commented 8 years ago

Forgot to actually update this for anyone else who stumbles across this, apparently srcds crashed and kept the port in use, and the port via that specific protocol was in use and thus never actually listened for rcon, requiring a reboot.

koraktor commented 8 years ago

Thanks for the explanation.