FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

[FishyFacePunch] - InvalidSocket Errors When you save New Code Changes, while Unity is In Play Mode.

Open Katerlad opened this issue 3 years ago • 1 comments

Hey PunFish, I should of brought this up earlier, but whenever scripts have to recompile in Unity, like when saving changes to your scripts in your IDE. If you are in Play Mode while doing this, these errors below will appear the next time you try to enter play mode. Causing you to have to restart unity to be able to connect to steam again. While its probably not good to recompile scripts while in play mode in the first place, it happens a lot during development.

Not sure if this is a Unity Problem or something with FishNet /FishyFacePunch/Steamworks.

This is just an annoyance / inconvenience just wanted to bring it up in case a smelly fish got into the net.

Things to note: Happens with Multipass with facepunch or just FishyFacePunch alone. Does not happen when using tugboat.

This can be Recreated with the same file as the Multipass one I gave earlier. Multipass Test.zip

Step 1. Click Play in Unity. Step 2. Press Server Button In UI. Step 3. Go into IDE and change any code, add a debug for example then save. Just need scripts to recompile. Step 4. Exit Play Mode. Step 5. ReEnter PlayMode Step 6. Press Server Button Again.

These Errors will occur below. From what I can tell there is no way to get rid of them without restarting Unity to be able to Start a server again.

ArgumentException: Invalid Socket
Steamworks.SteamNetworkingSockets.SetSocketManager (System.UInt32 id, Steamworks.SocketManager manager) (at <19bd4cc6a4004258bf538b05ac1133d6>:0)
Steamworks.SteamNetworkingSockets.CreateRelaySocket[T] (System.Int32 virtualport) (at <19bd4cc6a4004258bf538b05ac1133d6>:0)
FishyFacepunch.Server.ServerSocket.StartConnection (System.String address, System.UInt16 port, System.Int32 maximumClients) (at Assets/FishNet/Plugins/FishyFacepunch/Core/ServerSocket.cs:112)
FishyFacepunch.FishyFacepunch.StartServer () (at Assets/FishNet/Plugins/FishyFacepunch/FishyFacepunch.cs:415)
FishyFacepunch.FishyFacepunch.StartConnection (System.Boolean server) (at Assets/FishNet/Plugins/FishyFacepunch/FishyFacepunch.cs:343)
FishNet.Transporting.Multipass.Multipass.StartServer (System.Int32 index) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:861)
FishNet.Transporting.Multipass.Multipass.StartConnection (System.Boolean server, System.Int32 index) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:747)
FishNet.Transporting.Multipass.Multipass.StartConnection (System.Boolean server) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:723)
NetworkHudCanvases.OnClick_Server () (at Assets/FishNet/Example/Scripts/NetworkHudCanvases.cs:215)
UnityEngine.Events.InvokableCall.Invoke () (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <c6b52566f59b49fc861a7812a1ea2f6b>:0)
UnityEngine.UI.Button.Press () (at Library/PackageCache/[email protected]/Runtime/UI/Core/Button.cs:70)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/[email protected]/Runtime/UI/Core/Button.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/[email protected]/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at Library/PackageCache/[email protected]/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/[email protected]/Runtime/EventSystem/EventSystem.cs:501)
NullReferenceException: Object reference not set to an instance of an object
FishyFacepunch.Server.ServerSocket.IterateIncoming () (at Assets/FishNet/Plugins/FishyFacepunch/Core/ServerSocket.cs:282)
FishyFacepunch.FishyFacepunch.IterateIncoming (System.Boolean server) (at Assets/FishNet/Plugins/FishyFacepunch/FishyFacepunch.cs:213)
FishNet.Transporting.Multipass.Multipass.IterateIncoming (System.Boolean server) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:386)
FishNet.Managing.Transporting.TransportManager.IterateIncoming (System.Boolean server) (at Assets/FishNet/Runtime/Managing/Transporting/TransportManager.cs:364)
FishNet.Managing.Timing.TimeManager.TryIterateData (System.Boolean incoming) (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:1022)
FishNet.Managing.Timing.TimeManager.IncreaseTick () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:741)
FishNet.Managing.Timing.TimeManager.TickUpdate () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:389)
FishNet.Transporting.NetworkReaderLoop.Update () (at Assets/FishNet/Runtime/Transporting/NetworkReaderLoop.cs:28)

Katerlad avatar Sep 25 '22 20:09 Katerlad

I'll add a deinitializer in addition to the ondisable/destroy deinit to see if that will resolve the issue.

FirstGearGames avatar Oct 03 '22 13:10 FirstGearGames

I've not been able to reproduce but I have seen this before in other cases. I am adding a deinitializer to all of my transports. This will be completed by the time 2.5.9 comes out. If problems continue please feel free to re-open.

FirstGearGames avatar Oct 23 '22 18:10 FirstGearGames