LanDiscovery.SendBroadcast throws SocketException: Access denied
I'm using your network library for my game project. Everything is normal when I develop in window. But when I clone a project to MacOS, I have a problem. It threw exception "socket permission denied" in method SendBoardcast of class LanDiscovery. I think it not have permission for macOS network, although I ran unity as sudo. And I suspect IOS app maybe have this problem.
I'm using MacOS Monterey 12.2.1, and MacBook pro 2021
It threw exception "socket permission denied"
I'll look into it at some point (although it may be a while until I get around to it), but is that the full error message? Whatever other information may be included in the rest of the error could be helpful.
SocketException: Access denied
System.Net.Sockets.Socket.SendTo (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEP) (at <171a3352ba4a4b8aaa2993d306570161>:0)
System.Net.Sockets.Socket.SendTo (System.Byte[] buffer, System.Net.EndPoint remoteEP) (at <171a3352ba4a4b8aaa2993d306570161>:0)
RiptideNetworking.Utils.LanDiscovery.SendBroadcast () (at <205a6c4887a04d59abb3434ed0f7c989>:0)
CustomNetwork.RiptideTransporter+<HostScanning>d__11.MoveNext () (at Assets/Scripts/Network/RiptideTransporter.cs:66)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
this is full error message I got.
I have got this bug when build game to android. It maybe relate with this topic https://forum.unity.com/threads/solved-unity-android-udpclient-send-access-denied.842239/
And my game in PC cannot found host in android, although they are both found each other when using ping in command line
I know this is an old issue, but I got this exact error in OS X. I was able to get rid of it by adding the following to the constructor in LanDiscovery.cs (after initializing socket):
socket.EnableBroadcast = true;
Hope this helps!
Closing this as the LanDiscovery class was removed in v2 and would be completely overhauled if it ever makes a return.