int infoType = QueriEd.INFO_DETAILS;
int queryType = QueriEd.QUERY_GAMESPY2;
int gameType = QueriEd.GAME_BF2;
String queryResult = Util.getInfo(localPort, ipStr, port, infoType, queryType, gameType);
ServerInfo serverInfo = null;
if(queryResult != null && queryResult.length() > 0) {
serverInfo = new ServerInfo();
serverInfo.setGame(Util.getPartGS2(queryResult, "gamename"));
serverInfo.setGameVersion(Util.getPartGS2(queryResult, "gamever"));
serverInfo.setIp(ipStr);
serverInfo.setPort(Util.getPartGS2(queryResult, "hostport"));
serverInfo.setName(Util.getPartGS2(queryResult, "hostname"));
serverInfo.setMap(Util.getPartGS2(queryResult, "mapname"));
serverInfo.setPlayerCount(Util.getPartGS2(queryResult, "numplayers"));
serverInfo.setMaxPlayers(Util.getPartGS2(queryResult, "maxplayers"));
String gametype = Util.getPartGS2(queryResult,"gametype");
String gamevariant = Util.getPartGS2(queryResult,"gamevariant");
System.out.println("QueryResult: " + queryResult + "\n\n");
System.out.println("Server: " + ipStr + ": " + serverInfo.getName());
System.out.println("gametype: " + gametype + " - gamevariant: " + gamevariant);
}
}