Linux should do the same thing, and it's actually a very important feature.
A lot of protocols rely on this behavior, such as both TCP and UDP NAT
traversal.

That said, I'm unclear why so many of the examples use setReuseAddress,
although I think I remember Trustin saying it improved performance in his
tests.  Not sure why that would be the case, but it could be the reason.

-Adam


On 8/21/07, 向秦贤 <[EMAIL PROTECTED]> wrote:
>
> IMHO, there is BIG problem, Layer.
> even this way can be done, It not tcp stack concept.
> maybe it's problem about a chain of responsibility.
> If I work this, I would build a listening process, and dispatch some work
> to
> different worker do details.
>
> Regards,
>
> 2007/8/20, Maarten Bosteels <[EMAIL PROTECTED]>:
> >
> > 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.
> >
> > Maarten
> >
>
>
>
> --
> 致敬
> 向秦贤
>

Reply via email to