On 8/20/07, Maarten Bosteels <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I am witnessing some very weird behavior:  two processes listening on the
> same TCP port on the same machine.
> using Windows XP Professional
>
> I thought this might be possible because my portable is multi-homed (wired +
> wireless network) ?
> But I disabled the wireless network and it still works.
>
> 1st process = org.apache.mina.example.chat.Main
> 2nd process = org.apache.mina.example.chat.SpringMain
>
> Running two instances of org.apache.mina.example.chat.Main gives the
> expected "Address already in use"
> but it seems I can start as many instances of SpringMain as I want (I tried
> upto 6)
>
> Ok, this behavior is clearly a consequence of setting reuseAddress=true on
> the SocketAcceptor
> but I have never witnessed this behavior on linux.
>
> Does anybody know whether this is a documented feature on Windows ?
>
> C:\netstat -na | grep 1234
> TCP  0.0.0.0:1234     0.0.0.0:0         LISTENING
> TCP  0.0.0.0:1234     0.0.0.0:0         LISTENING
> TCP  127.0.0.1:1234   127.0.0.1:1379    ESTABLISHED
> TCP  127.0.0.1:1379   127.0.0.1:1234    ESTABLISHED
> (unfortunately netstat on windows doesn't have the -p option to show process
> id of listening process)
>
> Changing localAddress from  ":1234"  to "127.0.0.1:1234" or "
> 192.168.0.5:1234" doesn't make a difference.
>
> Clients seem to connect to the process that was started last.
> And when that server stops, new connections are accepted by an 'older'
> server.

It's probably because of setReuseAddress().  We need to get rid of
that line from all examples.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to