Why Ping.isdone can not true when ip match to the server

I search it for a long time but connot solve this problem. I am developing a multiplayer cards games in unity(C#) that running on all devices.For mutiplayer i am using hotspot network.one device create hotspot network other connect it then my application run it.when my application run on all devices one of them create a server other client join this server. for connecting the all client to the server i am using a loop(value=256) that check ip 1 by 1 of the server

Main Problem is that when my loop ip value match to the server but ip.isdone not true 256 time loop executed but ip not match to the server

The following is my code using Unity Ping

if(matching_ip== false ){

string[] piece = system_IP.Split('.');//system_ip or client ip 192.168.1.241

string ip_part_3 =piece[0]+"."+piece[1]+"."+piece[2]+"."+"0";//for checking server 192.168.1.0

         //compare ip address to server

    for(int i=1;i<=256;i++)
    {
        if(matching_ip== false){
          //icrease value 1 by 1
        ip_part_3 =piece[0]+"."+piece[1]+"."+piece[2]+"."+i; //192.168.1.1 increase value

        Ping test= new Ping(ip_part_3);

        
        **if(test.isDone)** one case ip match but this condition not true why?{

        print ("connected successfuly to server");

                        Network.Connect(ip_part_3, connectionPort);

        matching_ip=true;
               }
           }
        if(matching_ip== true){

            print ("LOOP Brake");
            break;
        }
    }

So is there anyone can tell me why the ping.isdone false? Or is there any better way to realize the function under Unity3d?

“Thanks for helping”

Just in case someone read this question. Ping is asynchronous so you cannot test it like that (here is the manual reference)