MadBoy Posted May 12, 2006 Share Posted May 12, 2006 Hey. I have compiled script that has UDP Server/Receiver functions. That's why i need to make sure it's not started again or it will return error to user. So i used _Singleton and tried to use ProcessExists too and it seemed to work fine but.. Whenever another instance is started, msgbox apears, script exists but it also crashes saying that "AutoIt crashed and i am asked if i want to send msg to Microsoft to solve the problem". Also if i will not use _Singleton/ProcessExists and just have those If @error <> 0 Then Exit it also crashes. I would rather expect it to just 'exit' as it is told to. Maybe it's some bug or maybe my usage is bad. if _Singleton($tag,1) = 0 Then Msgbox(0,"Warning","An occurence of UdpServer is already running. Terminating!") Exit EndIf UDPStartup() $socket_incoming = UDPBind($listening_udp_ip, $listening_udp_port) If @error <> 0 Then Exit $socket_outgoing = UDPOpen($udp_ip, $udp_port) If @error <> 0 Then Exit My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Uten Posted May 12, 2006 Share Posted May 12, 2006 (edited) Does it crash before or after? Msgbox(0,"Warning","An occurence of UdpServer is already running. Terminating!")Could it be that you do some cleanup (using a OnAutoItExit function?) on termination? Edited May 12, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
MadBoy Posted May 12, 2006 Author Share Posted May 12, 2006 Does it crash before or after? Msgbox(0,"Warning","An occurence of UdpServer is already running. Terminating!")Could it be that you do some cleanup (using a OnAutoItExit function?) on termination?It crashes after msgbox. Good question And the answer is YES. Func OnAutoItExit() UDPCloseSocket($socket_incoming) UDPCloseSocket($socket_outgoing) UDPShutdown() EndFunc My little company: Evotec (PL version: Evotec) 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