NetworkDiscovery cannot receive broadcast data..

I want to create a host and multi clients in a LAN network. The client can search host IP and connect to host automatically.
I consulted some documents and found the function can be implemented via ‘NetworkDiscovery’ API…
But however, I cannot receive any broadcast data, the method ‘OnReceivedBroadcast’ never executes…
Could someone help to check the codes and give any suggestion? Why the solution is not working…

public class NetServer : NetworkDiscovery
{
// Use this for initialization
void Start ()
{
Initialize ();
StartAsServer ();
broadcastData = Network.player.ipAddress;
NetworkManager.singleton.StartHost ();
}
}
public class NetClient : NetworkDiscovery
{
// Use this for initialization
void Start ()
{
Initialize ();
StartAsClient ();
}
public override void OnReceivedBroadcast(string fromAddress, string data)
{
NetworkManager.singleton.networkAddress = data;
NetworkManager.singleton.StartClient ();
}
}

I’m using Unity5.4.1f1

appreciate for your help:smile:

I open the host app firstly, then open the client app, I hope the client can connect to the host