On Friday, January 30, 2004, at 09:13 AM, Chris Sheffield wrote:
Thanks for the suggestions, Dar, but I think maybe not understand the
'accept' thing. It sounds like it should work, but I'm not quite getting
it. You don't by chance have a code sample do you? How will I know if the
accept command fails?
Off the top of my head:
******************************** constant lockPort = "46144"
function lockApp -- returns true iff OK to continue running
accept datagram connections on port lockPort with message closeRightAway
return the result is empty
end lockApp
function unlockApp close socket lockPort end unlockApp
on closeRightAway socketID, data close socket socketId end closeRightAway
*********************************
The system should close the listening port when the app quits, but you might want to put the unlockApp in all the right places, anyway.
The specific message on OS X when the port is busy is "can't bind endpoint", but I have noticed that messages do not always line up between systems. You can also check the syserr() to get the OS error code if you want to make sure the exact reason of failure is because there is another app using the port and not because the networking is broken or something.
Dar Scott
--
****************************************
Dar Scott Consulting
http://www.swcp.com/dsc/
Programming Services
****************************************_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
