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

Unable to CreateNormalSocket without first connecting to steam

Open jjolley opened this issue 4 years ago • 2 comments

Steamworks.SteamNetworkingSockets.CreateNormalSocket throws an error if Steamworks.SteamClient.Init is not first called.

Object reference not set to an instance of an object at Steamworks.SteamNetworkingSockets.CreateNormalSocket[T] (Steamworks.Data.NetAddress address) [0x0000d] in D:\a\Facepunch.Steamworks\Facepunch.Steamworks\Facepunch.Steamworks\SteamNetworkingSockets.cs:105

I understand this might be intentional. But I thought the point of using the SteamNetworkSockets library was that you could use the same code for connecting to Steam servers and not using steam servers at all. This limitation means I can't use the code when the user isn't connected to Steam.

Steps to reproduce the behavior:

  1. Don't call Steamworks.SteamClient.Init
  2. Call Steamworks.SteamNetworkSockets.CreateNormalSocket<T>
var socketManager = SteamNetworkingSockets.CreateNormalSocket<SocketManager>(NetAddress.AnyIp(12345));

I would expect this to work without needing to connect to steam. If I called SteamNetworkingSockets.CreateRelaySocket I would expect to need to be connected to Steam, but not for creating a normal socket

  • OS: Windows 10
  • Unity: Unity 2020.1.15f1

Thanks for the awesome library!

jjolley avatar Jan 14 '21 19:01 jjolley

I've had this issue recently as well. Caused me some confusion at first until I realised. I haven't tested it but does it work when you call for SteamServer.Init?

Scarso327 avatar Feb 17 '21 14:02 Scarso327

Also have this issue, would really like to use steam sockets for non-steam users as well but unless you initialize the client or the server it doesn't work as far as I can tell... Any updates on this?

I've had this issue recently as well. Caused me some confusion at first until I realised. I haven't tested it but does it work when you call for SteamServer.Init?

Yes it works if you call SteamServer.init(). That being said that doesn't do much for you in the case you want to set it up for non-steam users.

jfaz13 avatar Jan 15 '22 05:01 jfaz13