Re: Preventing multiple instance standalone desktop gui applications

From: Gordon Beaton (not_at_for.email)
Date: 09/28/04


Date: 28 Sep 2004 08:39:21 +0200

On 27 Sep 2004 16:38:38 -0700, Kent Yang wrote:
> My concern with socket approach is that one port will be dedicated
> to the application. I know its only one port / resource. The other
> concern is that I had socket applications that crash, and because it
> wasn't close properly, the socket can not be reused for a little
> while (probably because the OS resource not cleanup). So the port
> gets lock out until a system restart or until the OS catches up.

In practice, reusing a server port is never a problem.

Even if the ServerSocket constructor doesn't set SO_REUSEADDR (i.e.
setReuseAddress(true)) before binding the socket, you can. Although I
believe it does by default.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e


Relevant Pages

  • Re: How to determine if IPv6 is installed (using VC++ 6.0)
    ... >> don't bother to check that way, and simply open and use IPv6 sockets! ... resource is unavailable, you should ask to be given that resource when you ... will fail if that port is already bound". ... to see if port X is free, and if it is, to bind a socket to that port. ...
    (microsoft.public.win32.programmer.networks)
  • Re: Problem with socket
    ... Be aware that those port numbers are part of the IANA-assigned range. ... socket operations on sockets for which there are no handles... ... The result of using comma lists is ... you have used the completely meaningless word "crash" to describe your ...
    (microsoft.public.vc.mfc)
  • RE: call is blocked in recvfrom() and no further proceedings in Win CE
    ... In windows CE, I'm able to send a request but I'm unable to receive it. ... Create another socket & bind with server IP address. ... > My program has to send request to service through port 5070(in this port only ...
    (microsoft.public.windowsce.embedded)
  • Re: ISA Event
    ... applying ISA SP1 resolved the issue. ... So it's worth asking - is this SBS ... > Web Proxy service failed to bind its socket to 192.168.4.9 port 443. ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: Freebsd IP Forwarding performance (question, and some info) [7-stable, current, em, smp]
    ... INADDR_ANY and a specific port. ... sendtoon a specific address and port on a socket that has been bound to ... bogus exit code) and adds a sleep after send failure. ... unless HZ is too small or the queue is too large. ...
    (freebsd-net)