mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: NetworkDiscovery BroadcastAddress exposed for iOS support (#3255)
* exposing BroadCasting Address iOS build prevents broadcasting to 0.0.0.0, so we needed to expose it to change it for our built * Update NetworkDiscoveryBase.cs Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
This commit is contained in:
parent
33e0bea844
commit
fb95c411ef
@ -39,6 +39,10 @@ public abstract class NetworkDiscoveryBase<Request, Response> : MonoBehaviour
|
||||
[Tooltip("Time in seconds between multi-cast messages")]
|
||||
[Range(1, 60)]
|
||||
float ActiveDiscoveryInterval = 3;
|
||||
|
||||
// broadcast address needs to be configurable on iOS:
|
||||
// https://github.com/vis2k/Mirror/pull/3255
|
||||
public string BroadcastAddress = "";
|
||||
|
||||
protected UdpClient serverUdpClient;
|
||||
protected UdpClient clientUdpClient;
|
||||
@ -368,6 +372,18 @@ public void BroadcastDiscoveryRequest()
|
||||
}
|
||||
|
||||
IPEndPoint endPoint = new IPEndPoint(IPAddress.Broadcast, serverBroadcastListenPort);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(BroadcastAddress))
|
||||
{
|
||||
try
|
||||
{
|
||||
endPoint = new IPEndPoint(IPAddress.Parse(BroadcastAddress), serverBroadcastListenPort);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
using (NetworkWriterPooled writer = NetworkWriterPool.Get())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user