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

Dar Scott dsc at swcp.com
Fri Dec 3 11:34:44 EST 2004


On Dec 3, 2004, at 8:57 AM, Frank D. Engel, Jr. wrote:

> The operating system should prevent two different applications from
> listening on the same port.  Rev shouldn't have to worry about that at
> all.
>
> Rev has to go through the same APIs that C programs do (it is, after
> all, written in C/C++, is it not?) so at some level or another, it will
> be blocked from doing that, just as any other program would.
>
> OTOH, if Rev does not generate an error when this happens, it is indeed
> a problem that Rev will need  to deal with.
>
> 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?

For me, on Mac OS 9.2 and on Windows XP I'm getting something fishy.

It was some time ago on the Mac.  It might be that its listed twice but 
is not really opened twice.

On Windows XP, I'm getting no errors and netstat shows muliple 
listening sockets on the same port.  I reported this as part of bug 
828, the original entry for the Mac problem.

It might be that my system is messed up somehow.  Anybody else see this?

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.

I don't have a problem on OS X.  There I get an error message in the 
result if the port is in use for accept.

Dar

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



More information about the use-livecode mailing list