Dedicated Server "STEAM: Failed to respond IP:[MyPublicIP]" Suggestions?

Up to this point, I’ve been using the Steam OSS with my dedicated server without issue. I’d simply get the ID of the server using Steam’s server browser, and use open Steam.[ID] in the console of the client to connect to the server. I finally decided to implement some sort of basic matchmaking and to start I just want to connect to my server automatically. I start by creating a session on the server, then finding it on the client through a session search.

I create my session like this:

const IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
	if (!SessionInterface.IsValid())
	{
		OnCreateSessionCompleteEvent.Broadcast(false);
		return;
	}
	
// settings passed in when createsession function is called.
	LastSessionSettings = MakeShareable(new FOnlineSessionSettings());
	LastSessionSettings->NumPrivateConnections = NumPrivateConnections; // 0
	LastSessionSettings->NumPublicConnections = NumPublicConnections; // 16
	LastSessionSettings->bAllowInvites = AllowInvites; // true
	LastSessionSettings->bAllowJoinInProgress = AllowJoinInProgress; // true
	LastSessionSettings->bAllowJoinViaPresence = AllowJoinViaPresence; // false
	LastSessionSettings->bAllowJoinViaPresenceFriendsOnly = AllowJoinViaPresenceFriendsOnly; // false
	LastSessionSettings->bIsDedicated = IsDedicatedServer; // true
	LastSessionSettings->bUsesPresence = UsesPresence; // false
	LastSessionSettings->bIsLANMatch = IsLANMatch; // false
	LastSessionSettings->bShouldAdvertise = ShouldAdvertise; // true

	LastSessionSettings->Set(SETTING_GAMEMODE, FString("DeathMatch"), EOnlineDataAdvertisementType::ViaOnlineService);
	LastSessionSettings->Set(SETTING_MAPNAME, MapName, EOnlineDataAdvertisementType::ViaOnlineService);
	LastSessionSettings->Set(SETTING_MATCHING_HOPPER, FString("Deathmatch"), EOnlineDataAdvertisementType::DontAdvertise);
	LastSessionSettings->Set(SETTING_MATCHING_TIMEOUT, 120.f, EOnlineDataAdvertisementType::ViaOnlineService);
	LastSessionSettings->Set(SETTING_SESSION_TEMPLATE_NAME, FString("GameSession"), EOnlineDataAdvertisementType::DontAdvertise);
	
	CreateSessionCompleteDelegateHandle = SessionInterface->AddOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegate);

	
	if(!SessionInterface->CreateSession(0, NAME_GameSession, *LastSessionSettings))
	{
		UE_LOG(LogTemp, Warning, TEXT("Something went wrong while creating a session"));

		SessionInterface->ClearOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegateHandle);
		OnCreateSessionCompleteEvent.Broadcast(false);
	}

I search for my session like this:

const IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
	if (!SessionInterface.IsValid())
	{
		OnFindSessionsCompleteEvent.Broadcast(TArray<FOnlineSessionSearchResult>(), false);
		return;
	}
	
	UE_LOG(LogTemp, Warning, TEXT("Begin find sessions"));

	FindSessionsCompleteDelegateHandle = SessionInterface->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);

// settings passed in when findsessions function is called.
	LastSessionSearch = MakeShareable(new FOnlineSessionSearch());
	LastSessionSearch->MaxSearchResults = MaxSearchResults; // 10000
	LastSessionSearch->bIsLanQuery = IsLANQuery; // false
	LastSessionSearch->QuerySettings.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);

	UE_LOG(LogTemp, Warning, TEXT("end session finding rules"));
	
	const ULocalPlayer* localPlayer = GetWorld()->GetFirstLocalPlayerFromController();
	if (!SessionInterface->FindSessions(*localPlayer->GetPreferredUniqueNetId(), LastSessionSearch.ToSharedRef()))
	{
		SessionInterface->ClearOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegateHandle);

		OnFindSessionsCompleteEvent.Broadcast(TArray<FOnlineSessionSearchResult>(), false);
	}

I’m fairly certain that it’s working for the most part… At one point I accidentally had the client create the session, then also try to find and join one and it was indeed able to find and attempt to join itself (which failed because it was already in the session). When I search normally (with the server creating a session and the client searching for one), the client outputs the following logs:

LogOnlineSession: Warning: STEAM: Server response IP:[SomeoneElsesPublicIP]
LogOnlineSession: Warning: STEAM: Rules response [Rules from the other server that responded]
LogOnlineSession: Warning: STEAM: Failed to respond IP:[MyPublicIP]

Like I said before, I think the system is close to working, especially since I can join the server through the console, but I want to be able to search for it automatically. What am I doing wrong such that my server doesn’t properly respond like this other server that my client found? In my attempts to find an answer to this, the most I’ve seen is people suggesting that it’s probably a local firewall issue. I’ve gone as far as turning off the firewall on the windows pc that’s hosting the server to no avail. I’ve made sure to portforward both 7777 and 27015. I’m obviously missing something because others have been able to do this, but I just can’t figure it out and it’s been a pain in my backside for days now. Any help is greatly appreciated, thanks.

You’re not posting the actual IP addresses, so it’s hard to tell whether this is something simple or not.

It’s quite possible this problem is related to NAT punch-through, and your firewall/internet modem/access point/router. If so, you may wish to set up port forwarding, and making sure you use your external IP address as the server address. (This may also be done automatically by Steam in many cases, but compatibility is always a concern.)

So, is NotMyIP a private or public addres? Is MyIP a private or public address? If one of them is private, it’s very likely NAT related.

Apologies, these are both public IP addresses, and [NotMyIP] is just someone else’s server on Steam. I have both port 7777 and 27015 forwarded through my router and my external IP address is being used as the server’s address. When using NULL subsystem, connecting via IP works fine, and using the server’s Steam ID works without issue even on networks unrelated to my own.

What’s the SteamDevAppId in DefaultEngine.ini ? Is it your steam app ID?
Can you verify (by stepping in the debugger) that it’s putting the right app ID in the request?

I’m using the default test id of 480. Even without debugging I can tell it’s putting the right ID through. The results only show the servers on ID 480, and my IP/server is listed in steam’s server browser. (which is confirmed by the steam server browser matching the [SomeoneElsesPublicIP] server) Regardless, I made sure to double-check using the debugger and it is indeed putting the right app ID in the request. Here’s the networking part of my DefaultEngine.ini, perhaps I missed something or added something in there that could be causing my issues:

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
PollingIntervalInMs=20
DefaultPlatformService=Steam
VoiceNotificationDelta=0.2

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
SteamAppId=480
ModDir=spacewar
Description=MyGame
GameServerQueryPort=27015
bRelaunchInSteam=false
bUseSteamNetworking=false
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
; This is for using sessions
bInitServerOnClient=true
Achievement_0_Id=""

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

So then it’s not surprising that you receive matches from someone else also using this test ID.
I recommend actually signing up for the Steam development, and using that ID for your game, and chances are, you’ll get the matches you expect.

Another alternative is to set some particular property on the match listing that nobody else is using (like a specially named game mode or whatever) and use that to filter the listings/search. That may also work in the short term.

I’m fine with finding searches that aren’t mine, my issue is that I don’t know why their servers are properly responding with rules and the like, but my server responds with STEAM: Failed to respond IP: [MyPublicIP]. I can attempt to connect to other people’s sessions if they respond correctly, but I cannot connect to my server because it isn’t seen as a proper session, and fails to respond.

Ah, gotcha! Does the server get the packets from the matchmaker at all? You might be able to see them with logs, or using Wireshark.

First of all, I wanna appreciate all the help you’ve given so far. I did some more testing and found something that I somehow missed before. I don’t know how I missed this for so long but during session creation, the server outputs this log: LogOnlineSession: Warning: STEAM: Cannot create session 'GameSession': session already exists. This is kinda huge. I’m still kinda mad I missed it for so long. Unfortunately, I don’t seem to have a fix for this either. When googling that log, this is essentially the only thing that I can find relating to this log:

This ^ tells you to make sure your project has the correct map selected in project settings → packaging. I have made sure that the map here is correct, as well as in project settings → maps & modes → server level. Despite making sure these are still correct, I continue to get the Cannot create session log. Interestingly enough, when I added extra logs to my delegates to see what was happening, I would get a failure to create a session with the aforementioned log, then I get a session creation success.

I am sufficiently perplexed. I assume the initial failure is due to some system not having fully started, so it tries again and succeeds. Since my session is actually getting created, why the heck isn’t it responding to Steam properly??

So, as suggested, I dusted off Wireshark and give it a shot. There is definitely a recurring packet on the server’s pc at a timed interval as well as every time I hit the search button. Multicast Listener Report Message v2. I assume this is Steam requesting data be sent to the master server about this server. I don’t see any outbound packets in response though. My first thought would be firewall, but I’ve tried with the firewall turned off and still no luck.

Multicast is a link-local protocol, and probably not a part of the Steam connection. (Assuming that’s the correct name of the protocol, and not a glitch/mis-labeling.)

Also, aren’t you supposed to use the logged-in UserId for CreateSession()?

For Steam specifically or general session creation? I assume you’re talking about this line SessionInterface->CreateSession(0, NAME_GameSession, *LastSessionSettings. 0 is the user at index 0 if I remember correctly, and the function labels it as the HostingPlayerNum. Since this code only runs on the dedicated server, I assume it uses whatever instance of itself that’s running. The few resources I’ve seen on this use 0 and they don’t seem to have the same troubles that I’m experiencing, of course, if it’s supposed to be something specific for Steam, this could be my issue.

Yeah, on the UserId, I did a google code search, and found some examples that did get a UserId from a login and put it in there, which is why I wondered about that.
That being said – if you don’t see packets from the Steam servers using Wireshark, something’s wrong with the session registration.
You might need to step into the underlying code in the debugger to see if there are better error messages to read out there :frowning:

I have the same problem with our game. In our case, the problem happens when we put our dedicated server on Playfab. When it is, for example, on my second computer, everything works perfectly fine. (see this post for more details: Server fail to respond - Playfab Community)

@Web_Glitch , did you found a solution in your case?

Same problem…

I get the same log message: "Warning: STEAM: Failed to respond IP: "
However, this only happens when I try to host a server at another house which uses a different ISP. At home, I never get this error, and the client is able to find my server and join it (over Wi-Fi, after port forwarding).
Seems like this could be related to how the ISP handles port forwarding and other settings?

I fixed my issue.

With a client on my desktop, I was trying to connect to the dedicated server running on my laptop. Both in the same private network of my home. I was met with the STEAM: Failed to respond [IP] error everytime. I had to open ports 7777 and 27015:27050 (TCP/UDP), with the “destination IP” field being the IP of my laptop (the one running the dedicated server). Once I did that I was able to successfully join the dedicated server.

I fixed it for my case as well. I had to put my host device on the router in DMZ mode, and also trust my network in AVG firewall settings (not sure why it wasn’t already set to trusted). This was not neccessary for my different ISP/router at home, but made it work in this environment.