Progress on preventing multiple instances of a program from running in windows

Dar Scott dsc at swcp.com
Fri Dec 3 12:39:47 EST 2004


On Dec 3, 2004, at 10:14 AM, Alex Tweedly wrote:

>>> It *does* generate an error for me, though; check the value of "the
>>> result" right after the "accept" command.  If the socket does not 
>>> bind,
>>> it will be nonempty.  At least, for me it is.
>>
>> I assume you mean "does bind".  What OS?
>
> I think he did mean "does not bind".
> If it does bind successfully, the result should empty (and the socket 
> is now bound).
> On the second try, it does NOT bind - so the result should be 
> non-empty - probably some variant of "10048 Address in use".

Brain fault.  I filter most out before mail gets out.  I beg patience.

> That's the same as I see on  Win2000.

Could you mention it on bug 828?

>> However, since I have seen this on the Mac...  Maybe not.  Maybe 
>> Revolution is setting the bit to allow address-port pairs to be 
>> re-used.  Maybe by accident or maybe for some purpose that I don't 
>> understand.
>
> Cold be something like that - there's something very odd going on:
> he rev server has pre-empted an existing, listening server.   Very odd.
[scenarios deleted]

You have just convinced me that Rev is setting the option to re-use the 
port.  There is no good reason to do this.  I make tenacious listeners 
by simply retrying after a little while if the port is in use.  A 
server application should be free to give up, or keep trying to accept 
connections and in the latter it should be able to indicate as status 
that the port is in use.

A socket implementation (according to my reference) is free to ignore 
this option and that may be what OS X is doing.  I don't know if the 
exact meaning is defined anywhere, anyway.

Maybe the code is using an option mask that sets some option in unix, 
but that bit corresponds to the re-use-port option in other systems.

Dar

****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list