Can't create Steam Sessions (Steam Sockets)

Hello,

I am creating a Multiplayer game which uses Steam.
Now I already have a AppID and the game is available on Steam, but for some reason I am having issues when creating a session.

This is the relevant part which gives the error when I cmd run a Standalone Game with -game -log:

[2021.07.02-11.05.54:525][530]LogModuleManager: Warning: ModuleManager: Unable to load module 'SocketsSTEAM'  - 0 instances of that module name found.
[2021.07.02-11.05.54:526][530]LogSockets: Warning: Unable to load SocketSubsystem module STEAM
[2021.07.02-11.05.54:565][530]LogNet: ReplicationDriverClass is null! Not using ReplicationDriver.
[2021.07.02-11.05.54:566][530]LogNetCore: DDoS detection status: detection enabled: 0 analytics enabled: 0
[2021.07.02-11.05.54:587][530]LogSockets: Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
[2021.07.02-11.05.54:588][530]LogNet: Warning: Could not create socket for bind address 76561199171923879, got error SteamSockets: setsockopt SO_BROADCAST failed (0)
[2021.07.02-11.05.54:589][530]LogSockets: Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
[2021.07.02-11.05.54:589][530]LogNet: Warning: Could not create socket for bind address ::, got error SteamSockets: setsockopt SO_BROADCAST failed (0)
[2021.07.02-11.05.54:589][530]LogNet: Warning: Encountered an error while creating sockets for the bind addresses.
[2021.07.02-11.05.54:590][530]LogNet: Warning: Failed to init net driver ListenURL: /Game/Maps/PlayerHub?listen:
[2021.07.02-11.05.54:597][530]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = NetDriverListenFailure, ErrorString = , Driver = GameNetDriver IpNetDriver_0
[2021.07.02-11.05.54:597][530]LogNet: Warning: Network Failure: GameNetDriver[NetDriverListenFailure]:
[2021.07.02-11.05.54:598][530]LogNet: NetworkFailure: NetDriverListenFailure, Error: ''
[2021.07.02-11.05.54:610][530]LogWorld: Failed to listen:
[2021.07.02-11.05.54:610][530]LogNet: DestroyNamedNetDriver IpNetDriver_0 [GameNetDriver]
[2021.07.02-11.05.54:665][530]LogNet: Error: LoadMap: failed to Listen(/Game/Maps/PlayerHub?listen)

It says there is no module to load called SocketsSTEAM.

This is in my DefaultEngine.ini file:

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
MaxClientRate=6000000
MaxInternetClientRate=6000000
      
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=6000000
MaxInternetClientRate=6000000
      
[/Script/Engine.Player]
ConfiguredInternetSpeed=6000000
ConfiguredLanSpeed=6000000

[/Script/Engine.NetworkSettings]
net.MaxRepArraySize=65535

[/Script/Engine.GameNetworkManager]
TotalNetBandwidth=6000000
MaxDynamicBandwidth=800000
MinDynamicBandwidth=4000

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

[OnlineSubsystem]
DefaultPlatformService=Steam
PollingIntervalInMs=20
bUseBuildIdOverride=true
BuildIdOverride=420
bInitServerOnClient=true
VoiceNotificationDelta=0.2 

[OnlineSubsystemSteam]
bInitServerOnClient=true
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
bEnableSteam=true
bEnabled=true
bUseSteamNetworking=true
SteamDevAppId=1646880
SteamAppId=1646880
GameServerQueryPort=27015
bRelaunchInSteam=true
bVACEnabled=1
GameVersion=1.0.0.0

I have enabled the Steam plugins in the editor as well.

Itā€™s a shame the documentation is so poor.
Please if anyone can help me out, or if you need more files, let me know!
Many thanks!

1 Like

Same here, but donā€™t hold your breath on getting any kind of help with it.

your serverā€™s ports must be between 27015 and 27050 to start listening with SteamNetDriver. If the ports are exactly 27015 or 27050 it wonā€™t work, it needs to be between that range, if itā€™s out of range the server will also work, but it wonā€™t show up in the steam server list. Start your server like ā€œ-log -port 27022ā€ This link will help you: Ports Required for Steam . Do not forget to open the ports on the modem and windows, you also need to disable the firewall.

Iā€™m using SteamSocket plugin.

My DefaultEngine.ini:

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/SteamSockets.SteamNetSocketsNetDriver")

;NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver") NƃO USADO

[Voice]
bEnabled=true

[OnlineSubsystem]
DefaultPlatformService="Steam"
bHasVoiceEnabled=true
bAllowP2PPacketRelay=true
bUseSteamNetworking=true
bUseBuildIdOVerride=true
BuildIdOverride=1

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
SteamAppId=480
GameServerQueryPort=27015
bRelaunchInSteam=false
bUseSteamNetworking=true ;alterado
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true ;alterado
P2PConnectionTimeout=180
bUseLobbiesIfAvailable = false ;alterado
bInitServerOnClient=false

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

[Core.Log]
LogOnline=All
LogOnlineGame=All

1 Like

Thanks for your post! I donā€™t know if it helped the person initially asking but I just found it and it seems the changes I borrowed from your config file was able to make SteamSockets work for me in Lyra.

I havenā€™t done any extensive testing with it yet but thanks again!

1 Like

What changes did you do?

1 Like

If I were to guess what actually fixed my issue (I did add a few changes from your example but this one was the most significant I think.)

+NetDriverDefinitions=(DefName=ā€œGameNetDriverā€,DriverClassName=ā€œ/Script/SteamSockets.SteamSocketsNetDriverā€,DriverClassNameFallback=ā€œ/Script/SteamSockets.SteamNetSocketsNetDriverā€)

as opposed toā€¦

;+NetDriverDefinitions=(DefName=ā€œGameNetDriverā€,DriverClassName=ā€œOnlineSubsystemSteam.SteamNetDriverā€,DriverClassNameFallback=ā€œOnlineSubsystemUtils.IpNetDriverā€)

I did get it working and was able to create/join games with my Lyra example through Steam. Iā€™d like to note though that there seems to be a bug with 5.1 that causes the server to refuse packets from the client sometimes. I canā€™t reproduce it all the time but youā€™ll see it in the console output on the server side if it canā€™t verify the packets.

One last note, ā€œbUseLobbiesIfAvailable = falseā€ I noted could also have something to do with me being able to get joining games working properly- but that stuff comes after Steam Sockets are fixed and the server can create a game properly.

1 Like

Did you use Shipping build when connecting successfully? Did you disable net.VerifyNetSessionID and VerifyNetClientID? I was able to connect in Development build but not in Shipping.

1 Like

I havenā€™t tried cooking a shipping build yet but I am aware that there was a bug that has since been fixed in those console commands. I am not sure if my github source is from before or after that- but I know what the error message looks like and Iā€™m a ways away from shipping what Iā€™m working on.

1 Like

I had to make false those flags as well as fixing the code which was wrong cvar. (here) Now I can connect in Shipping build successfully. I hope it wonā€™t broke someway :slight_smile: I will make dedicated server support for this game and it looks like itā€™ll be much more difficult since I spent 3 months just for connecting P2P. But it helps me to learn a lot about Sockets, Debugging, Source Version etc.

1 Like

The NetDriverDefinitions change that you mentioned did make it so that I could create P2P sessions properly and they show up in the ā€œBrowseā€ list as expected, but when I try to join them I get a net driver error like this.

[2023.05.29-00.34.37:923][853]LogCommonSession: 	Found session (UserId: 76561199286277723, UserName: pattern, NumOpenPrivConns: 0, NumOpenPubConns: 15, Ping: 9999 ms
[2023.05.29-00.34.39:155][ 30]LogUIActionRouter: Display: Applying input config for leaf-most node [W_NonInteractiveSpinner_C_0]
[2023.05.29-00.34.39:155][ 30]LogUIActionRouter: Display: [User 0] Focused desired target W_NonInteractiveSpinner_C_0
[2023.05.29-00.34.39:299][ 51]LogUIActionRouter: Display: Applying input config for leaf-most node [W_SessionBrowserScreen_C_0]
[2023.05.29-00.34.39:299][ 51]LogUIActionRouter: Display: [User 0] Focused desired target LyraListView
[2023.05.29-00.34.39:299][ 51]LogOnlineSession: STEAM: Using P2P Data for Connection Serialization
[2023.05.29-00.34.39:299][ 51]LogOnlineSession: Warning: STEAM: Unable to set search parameter OSSv1: Value=true : Equals : -1
[2023.05.29-00.34.39:299][ 51]LogOnlineSession: Warning: STEAM: Unable to set search parameter LOBBYSEARCH: Value=true : Equals : -1
[2023.05.29-00.34.39:303][ 51]LogNet: Browse: steam.76561199286277723/Game/System/FrontEnd/Maps/L_LyraFrontEnd
[2023.05.29-00.34.39:303][ 51]LogNet: CreateNamedNetDriver failed to create driver from definition GameNetDriver
[2023.05.29-00.34.39:303][ 51]LogNet: CreateNamedNetDriver failed to create driver PendingNetDriver from definition GameNetDriver
[2023.05.29-00.34.39:303][ 51]LogNet: Warning: Error initializing the pending net driver.  Check the configuration of NetDriverDefinitions and make sure module/plugin dependencies are correct.
[2023.05.29-00.34.39:303][ 51]LogNet: Warning: Travel Failure: [PendingNetGameCreateFailure]: Error creating network driver.
[2023.05.29-00.34.39:303][ 51]LogCommonSession: Warning: TravelLocalSessionFailure(World: /Game/System/FrontEnd/Maps/L_LyraFrontEnd.L_LyraFrontEnd, FailureType: PendingNetGameCreateFailure, ReasonString: Error creating network driver.)
[2023.05.29-00.34.39:303][ 51]LogNet: TravelFailure: PendingNetGameCreateFailure, Reason for Failure: 'Error creating network driver.'
[2023.05.29-00.34.39:303][ 51]LogNet: Warning: Travel Failure: [ClientTravelFailure]: 
[2023.05.29-00.34.39:303][ 51]LogCommonSession: Warning: TravelLocalSessionFailure(World: /Game/System/FrontEnd/Maps/L_LyraFrontEnd.L_LyraFrontEnd, FailureType: ClientTravelFailure, ReasonString: )
[2023.05.29-00.34.39:303][ 51]LogNet: TravelFailure: ClientTravelFailure, Reason for Failure: ''
[2023.05.29-00.34.39:304][ 51]LogLoadingScreen: Showing loading screen when 'IsShowingInitialLoadingScreen()' is false.
[2023.05.29-00.34.39:304][ 51]LogLoadingScreen: We have pending travel (the TravelURL is not empty)
[2023.05.29-00.34.39:327][ 51]LogLoadingScreen: Loading screen showing: 1. Reason: We have pending travel (the TravelURL is not empty)
[2023.05.29-00.34.39:328][ 52]LogNet: Browse: /Game/System/FrontEnd/Maps/L_LyraFrontEnd?closed
[2023.05.29-00.34.39:329][ 52]LogNet: Connection failed; returning to Entry
[2023.05.29-00.34.39:329][ 52]LogLoad: LoadMap: /Game/System/FrontEnd/Maps/L_LyraFrontEnd?closed

At the moment my INI file looks like this.

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName=ā€œGameNetDriverā€,DriverClassName=ā€œ/Script/SteamSockets.SteamSocketsNetDriverā€,DriverClassNameFallback=ā€œ/Script/SteamSockets.SteamNetSocketsNetDriverā€)


[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=2321890
GameServerQueryPort=27022
bRelaunchInSteam=false
bUseSteamNetworking=true
bAllowP2PPacketRelay=true
P2PConnectionTimeout=180
bUseLobbiesIfAvailable = false
bInitServerOnClient=false

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

Iā€™m pretty stumped as to how to resolve this so any help is greatly appreciated!