Riptide icon indicating copy to clipboard operation
Riptide copied to clipboard

LanDiscovery.SendBroadcast throws SocketException: Access denied

Open marverlous811 opened this issue 3 years ago • 3 comments

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

marverlous811 avatar May 31 '22 03:05 marverlous811

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.

tom-weiland avatar Jun 01 '22 04:06 tom-weiland

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.

marverlous811 avatar Jun 02 '22 05:06 marverlous811

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

marverlous811 avatar Jun 12 '22 11:06 marverlous811

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!

bschoun avatar Oct 04 '23 19:10 bschoun

Closing this as the LanDiscovery class was removed in v2 and would be completely overhauled if it ever makes a return.

tom-weiland avatar Nov 22 '23 23:11 tom-weiland