Well - both instances were, indeed, set to listen - but I only told one of them to do it. The other just did it on its own after it wrote to the socket.
I will try the method you suggested earlier - it seems quite clever! There are bits of it that I do not fully understand, but that's what learning is all about:) Thanks muchly -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Tweedly Sent: Friday, December 03, 2004 1:19 PM To: How to use Revolution Subject: RE: Progress on preventing multiple instances of a program from running in windows At 12:59 03/12/2004 -0500, Lynch, Jonathan wrote: >The fact that, on my windows XP computer, Rev is automatically setting >itself up to listen to a port to which it just wrote a message seems >awfully odd. > >My understanding of ports and sockets is weak - but shouldn't it be able >to write to socket "127.0.0.1:48953" without setting itself up as >listening to port 48953? Yes, it should (and can - as verified by the echo server I sent earlier ....) Your previous email implied something slightly different from what you say here or at least, I read it slightly differently ...) You said then (my emphasis) >What was happening was that BOTH INSTANCES WERE SET TO LISTEN to that >port, but once the port was read by one instance, it was not read by the >other. > >The solution is like this: >Open socket to "127.0.0.1:48953" >Write "QueryInstance" to socket "127.0.0.1:48953" >Close socket "127.0.0.1:48953" >Close socket "48953" I think what you are seeing is some variant of the re-use socket problem. Because Rev is telling the OS to re-use the same socket address, things are acting a bit screwy. I can't exactly explain what you're seeing - but I'm pretty sure there's something about reusing sockets behind it. If you want to send a more complete code fragment, I can give it a try - but I suspect that port re-use will catch us out one way or another. Note that my long post earlier (which first tried to open the port - and if that failed, only then went into server mode and did an Accept) avoids the re-use issue completely, and should work on any OS. >Is there a shell command for writing to a socket that could be used that >might not have this behavior? Nothing very convenient. >My method of closing port 48953 after writing to "127.0.0.1:48953" (and >doing the same with port 48954 for communicating in the reverse >direction) works to allow two instances of a stack, running under two >different instances of Rev, to communicate with each other - however, >when I save the same stack as a standalone and try it with two instances >of that standalone, they only manage to pass a couple messages before >getting confused. It's also quite inefficient (opening and closing ports). I wonder if it may be running into problems with Time-Wait (ports that are closed are put into a temporary time-wait state to avoid problems of late packet arrival - and that can cause problems when you are rapidly binding and closing the same port). >If it were possible to write to socket without trying to steal the >listening of that stack, it would be much easier. Try the long code fragment I sent - I'm pretty sure it will work generally, and it definitely is OK on Windows (2000 and I also tested it on XP under Dreamcard Player). -- Alex. _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
