当前位置:编程学习 > wap >>

AsyncUDPsocket 循环发送udp包的问题

设置了一个按钮来执行循环发送广播消息,但是如果循环次数多点击了按钮以后界面死掉了,无法操作其他项,循环次数少的情况下可以在发送完成后恢复正常,请求援助!

for (int sn=0;sn<20;sn++)
    {
        for (int k=0; k<send_len+2; k++)
        {
            [self sendUDPr1:send5 address:@"255.255.255.255" port:16000];     //稍稍重写了下发送函数
            [self sendUDPr2:send25 address:@"255.255.255.255" port:16000];
            
            if(k == 0)
            {
                sendlength = 1199;
                for(j=0; j<sendlength; j++)
                {
                    send_b[j] = '3';
                }
                [self sendUDPr3:send_b address:@"255.255.255.255" port:16000 dalength:sendlength];
            } 
            else if(k == (send_len + 1))
            {
                sendlength = 299;
                for(j=0; j<sendlength; j++)
                {
                    send_b[j] = '3';
                }
                [self sendUDPr3:send_b address:@"255.255.255.255" port:16000 dalength:sendlength];
            }
            else
            {
                sendlength = send_ma[k-1] + 512;
                for(j=0; j<sendlength; j++)
                {
                    send_b[j] = '3';
                }
                [self sendUDPr3:send_b address:@"255.255.255.255" port:16000 dalength:sendlength];
            }
        }
    }
补充:移动开发 ,  iPhone
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,