82809085 发表于 2013-4-5 01:53:57

求助

本帖最后由 82809085 于 2013-4-5 02:07 编辑

#include <CoProc.au3>
UDPStartup();开启UDP
Local $id = 0
$client = UDPBind(@IPAddress1, 65532)
While 1
        $data = UDPRecv($client, 50)
        If $data <> "" Then
                MsgBox(64, '', $data, 1)
        EndIf
       
        If $data = '' Then
                If $id = 0 Then _CoProc("Timer1")
                $id = 1
        EndIf
WEnd

Func Timer1()
        While 1
                UDPStartup();服务端
                $server = UDPOpen("192.168.1.255", 65532)
                UDPSend($server, @IPAddress1)
                Sleep(100)
        WEnd
EndFunc   ;==>Timer1


Func OnAutoItExit()
        UDPCloseSocket($client)
        UDPShutdown()
EndFunc   ;==>OnAutoItExit

谁能修改下UDP服务不存在的情况下 启用UDP服务
存在的情况下 则提示        MsgBox(0, "UDP DATA", $data, 1)这段内容

现在情况是这样的 当其中一台程序退出了 但本机还会获取那台机器的信息
能帮我修改成 当其中一台UDP服务器不存在的时候 则立刻架设本机的UDP服务
页: [1]
查看完整版本: 求助