Steamworks.NET icon indicating copy to clipboard operation
Steamworks.NET copied to clipboard

SteamGameServer not showing up (FailedToRespond)

Open 1polygon opened this issue 6 years ago • 3 comments

I can't get the server to show up in the server browser correctly. It's only listed as unresponsive. If i enter this URL http://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001/?format=json&addr=<my_ip> i get the following response: {"response":{"success":true,"servers":[{"addr":"<my_ip>:27016","gmsindex":65534,"appid":480,"gamedir":"spacewar","region":-1,"secure":true,"lan":false,"gameport":27015,"specport":0}]}}

When i start the server everything looks fine. It connects to steam successfully and i get the game server id so i don't really know what im doing wrong here.

I use the following code to start the server:

const string GAME_SERVER_VERSION = "1.0.0.0";
const ushort GAME_AUTHENTICATION_PORT = 8766;
const ushort GAME_SERVER_PORT = 27015;
const ushort GAME_MASTER_SERVER_UPDATER_PORT = 27016;


protected Callback<SteamServersConnected_t> CallbackSteamConnect;
protected Callback<SteamServerConnectFailure_t> CallbackSteamFailure;
protected Callback<SteamServersDisconnected_t> CallbackSteamDisconnect;
protected Callback<GSPolicyResponse_t> CallbackPolicyResponse;
protected Callback<ValidateAuthTicketResponse_t> CallbackGSAuthTicketResponse;


protected Callback<P2PSessionRequest_t> CallbackP2PSessionRequest;
protected Callback<P2PSessionConnectFail_t> CallbackP2PSessionConnectFail;


public string ServerName = "Test Server";
public string MapName = "Milky Way";
public int MaxPlayers = 4;

public bool Initialized;
public bool ConnectedToSteam;

public void StartServer() {
    CallbackSteamConnect = Callback<SteamServersConnected_t>.CreateGameServer(OnSteamServersConnected);

    CallbackSteamFailure = Callback<SteamServerConnectFailure_t>.CreateGameServer(OnSteamServersConnectFailure);
    CallbackSteamDisconnect = Callback<SteamServersDisconnected_t>.CreateGameServer(OnSteamServersDisconnected);
    CallbackPolicyResponse = Callback<GSPolicyResponse_t>.CreateGameServer(OnPolicyResponse);

    CallbackGSAuthTicketResponse = Callback<ValidateAuthTicketResponse_t>.CreateGameServer(OnValidateAuthTicketResponse);
    CallbackP2PSessionRequest = Callback<P2PSessionRequest_t>.CreateGameServer(OnP2PSessionRequest);
    CallbackP2PSessionConnectFail = Callback<P2PSessionConnectFail_t>.CreateGameServer(OnP2PSessionConnectFail);


    Initialized = false;
    ConnectedToSteam = false;

    EServerMode eMode = EServerMode.eServerModeAuthenticationAndSecure;


    Initialized = GameServer.Init(0, GAME_AUTHENTICATION_PORT, GAME_SERVER_PORT, GAME_MASTER_SERVER_UPDATER_PORT, eMode, GAME_SERVER_VERSION);
    if (!Initialized) {
        Debug.Log("SteamGameServer_Init call failed");
        return;
    }
    print("Initialized");

    SteamGameServer.SetModDir("spacewar");

    SteamGameServer.SetProduct("Test");
    SteamGameServer.SetGameDescription("Hello World");

    SteamGameServer.LogOnAnonymous();
    
    SteamGameServer.EnableHeartbeats(true);
    Debug.Log("Started.");

    
}

1polygon avatar Aug 24 '18 17:08 1polygon

Are you running GameServer.RunCallbacks()? Not sure if that would cause it or not but

rlabrecque avatar Aug 25 '18 00:08 rlabrecque

Yes i can connect to the server via steam id and send/receive packets. I tested it with the game server test project and it also fails to respond when doing a server list request.

1polygon avatar Aug 25 '18 19:08 1polygon

Did you come up with a solution to this? It sounds exactly like an issue I'm having - I can't see the game on the master server list, but it's turning up just fine in a LAN search.

djarcas avatar Dec 20 '20 01:12 djarcas