After the establishment of unity udp Fi iOS packaged encountered in coroutine

Due to the need, we had a lower machine connected to hot and software communication protocol used udp. Wherein a feature is detected at every 2s local IP, IP switch automatically if found, to remind the user (the user is not connected to prevent hot spots on the open software). code show as below:

CheckIPPeriod the IEnumerator () 
    { 
        the IPAddress recip = and localIP;
         the while ( to true ) 
        { 
            // every checkIPPeriod periodically detect 
            the yield  return  new new WaitForSeconds (checkIPPeriod); 
            and localIP = GetLocalIP (); // get local the IP
             // as hotspots and communication, to the same network segment and remoteIP 
            IF (localIP.ToString (). the Contains (remoteIP.Substring ( 0 , remote.ToString (). the LastIndexOf ( ' . ' ) + . 1 ))) 
            { 
                IF (localIP.ToString ()! =recIP.ToString ()) 
                { 
                    CloseUdpClient (); // turn off the old 
                    InitializeUdpClient (); // open new connection 
                    // send some data, activate a communication 
                    SendDataToRemoteHost ( new new  byte [] { 0 , 0 , 0 }, . 3 ); 
                    WarningAction .Invoke (? " is connected to an engine hot spots " , 10 ); 
                } 
            } 
            the else 
            { 
                WarningAction .Invoke (? " Please connect the engine hot spots " , 100);
            }
            recIP = localIP;
        }
    }

It was found that do not have any problems after Andrews packed, but after iOS package, the program will be stuck in the network connection is established, and debugging tips such an error:

dnssd_clientstub write_all(17) DEFUNCT

dnssd_clientstub deliver_request ERROR:write_all(17,58bytes)failed

dnssd_clientstub write_all(17) DEFUNCT

How the Internet can not find a solution, then this coroutine removed, there is no such mistake. Although communication between the hot and still in building a connection will be stuck for a long time (about 20--30s), but behind the communication is no problem. But still there is a problem not want to understand, why I use the same code, the same mobile phone and computer connections available (there is a network of) the initial communication between hotspots, mobile phones and computers no problem, that there is no delay Caton . And while their company to do the next crew communication will focus Caton so long?

 

Guess you like

Origin www.cnblogs.com/BlueTargetDrone/p/11306692.html