public void Broadcast() { try { Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); IPAddress broadcast = IPAddress.Parse("192.168.43.255"); IPEndPoint ep = new IPEndPoint(broadcast, 4210); while (Running) { if (EnableBroadcasts) { Debug.Log("Broadcasting..."); s.SendTo(OperationParser.Broadcast(AcceptingPort), ep); } Thread.Sleep(BroadcastFrequency * 1000); } s.Close(); } catch (Exception e) { Debug.Log(e.ToString()); } }