yair Posted December 6, 2011 Share Posted December 6, 2011 (edited) im trying to setup a simple crash detector. my software will send an int every few seconds via udp socket autoit3 should run in loop and trip on failed transmition. i tried doing it like so but am getting a brain freeze. ; Start The UDP Services ;============================================== UDPStartup() ; Register the cleanup function. OnAutoItExitRegister("Cleanup") ; Bind to a SOCKET ;============================================== $socket = UDPBind("127.0.0.1", 65532) If @error <> 0 Then Exit While 1 $data="" $data = UDPRecv($socket, 50) $msg="stop" ;my software send sa "3" and it apears as this... If $data == "0x696E74002C69000000000003" Then $msg="continue" EndIf sleep(1000) if $msg == "stop" Then ExitLoop WEnd MsgBox("error","",1) Func Cleanup() UDPCloseSocket($socket) UDPShutdown() EndFunc any help? Edited December 6, 2011 by yair Link to comment Share on other sites More sharing options...
magodiez Posted December 12, 2011 Share Posted December 12, 2011 Probably you should wait to be sure you get some data... what about something like this? ; Start The UDP Services ;============================================== UDPStartup() ; Register the cleanup function. OnAutoItExitRegister("Cleanup") ; Bind to a SOCKET ;============================================== $socket = UDPBind("127.0.0.1", 65532) If @error <> 0 Then Exit While 1 $data="" $data = UDPRecv($socket, 50) If $data <> "" Then ;wait until we get some data ;my software send as "3" and it apears as this... If $data <> "0x696E74002C69000000000003" Then ExitLoop ;if not expected data exit EndIf EndIf sleep(1000) WEnd MsgBox("error","",1) Func Cleanup() UDPCloseSocket($socket) UDPShutdown() EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now