harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: [classlib][luni] new test in tests.api.java.net.SocketTest failed on my Windows XP sp2
Date Wed, 18 Apr 2007 07:44:39 GMT
On 4/18/07, LvJimmy´╝îJing <firepure@gmail.com> wrote:
>
> This method is good, but not perfect, for
> 1. getNextPortsForUDP get a free port by a mechanism "get and
> release", but release the port may not be successful (e.g, in linux)
>
2. even it releases successfully, during the period between utility
> method "release" and serversocket reuse it, there may be some other
> program reuse the port, which cause the test fail again.


Open and close is not safe in theory, as we discussed before.
Let's stop getNextPort, and stick to use port 0. :) I think we have agreed
that a long time ago.


3. this may cost much more time to get a port.
>
The perfect solution for this is re-write the testcases, create
> ServerSocket with port 0, and then get the local port for socket to
> connect. However I guess it may cause a lot of affect.


yes, but we can do it lazily and gradually. The important thing is that we
should not use the buggy getNextPort any more....

2007/4/18, Tony Wu <wuyuehao@gmail.com>:
> > Hi Nathan,
> > Many testcases in ServerSocketTest use port 0 to start the server then
> > call getLocalPort to get the actual port.
> >
> > BTW, the PortManger.getNextPortsForUDP makes use of port 0 to get the
> > real port number. It's safer, I suggest to replace all the getNextPort
> > with this method in our code.
> >
> > On 4/18/07, Nathan Beyer <ndbeyer@apache.org> wrote:
> > > For the slow (and lazy), can you point me to one of the tests that
> > > just uses port 0.
> > >
> > > Thanks.
> > >
> > > -Nathan
> > >
> > > On 4/17/07, Tim Ellison <t.p.ellison@gmail.com> wrote:
> > > > Ruth Cao wrote:
> > > > > You are right, Vladimir.
> > > > >
> > > > > It is just because the 'port' variable is set to 8080 and on some
> > > > > machines this port has already been occupied.  The test case will
> pass
> > > > > if we use Support_PortManager.getNextPort() on my side.
> > > >
> > > > Please don't use the PortManager, just open port 0 and let the OS
> > > > allocate a free port.  There are examples in the existing tests.
> > > >
> > > > Regards,
> > > > Tim
> > > >
> > >
> >
> >
> > --
> > Tony Wu
> > China Software Development Lab, IBM
> >
>
>
> --
>
> Best Regards!
>
> Jimmy, Jing Lv
> China Software Development Lab, IBM
>



-- 
Best regards,
Andrew Zhang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message