oops...:)
Ruth has a very special case...
On 4/19/07, Andrew Zhang <[EMAIL PROTECTED]> wrote:
On 4/19/07, Leo Li <[EMAIL PROTECTED]> wrote:
>
> Hi, Andrew:
> Actually, the Support_PortManager works as you suggest.:)
> But shall we wait a little before starting test, due to the
> half-close mechanism of TCP. That is three times of RTTI or something...
I
> do not remember clearly.
No Leo, I said "why do we need" these steps (which has many potential
problems), and the ideal result is the same as "return new
ServerSocket(0)".
:)
On 4/19/07, Andrew Zhang <[EMAIL PROTECTED]> wrote:
> >
> > On 4/19/07, Leo Li <[EMAIL PROTECTED]> wrote:
> > >
> > > Personally I prefer Support_PortManager. As a tool, it can rescue us
> > from
> > > choosing specific port to use. Despite of its defect, I believe it
is
> > > possible to innovate it to fullfill our demand. From my experience,
it
> > > works
> > > well on windows but has some problem on linux.
> > >
> > > Furthermore, if we would like to use a specific port but not
> predefined
> > at
> > > compile time, as the case of Ruth, maybe we can adopt a method of
> > ad-hoc,
> > > that is to try a specific port, if it is occupied, try another till
it
> > > works.
> >
> >
> > I think at most we need a utility method:
> > ServerSocket NetworkUtil.startServerSocket() {
> > return new ServerSocket(0);
> > }
> > Why do we need to:
> > 1. open a server socket on free port
> > 2. get the server socket port
> > 3. close it
> > 4. pass the port to the test case
> > 5. the test case opens a server socket on this port
> > Isn't it the same as:
> > The test case opens a server socket on free port? Or did I missing
> > something?
> >
> > On 4/19/07, Ruth Cao <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Tim Ellison 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
> > > > >
> > > > >
> > > > Yes, I agree that we should use port 0 in almost all the test
cases.
> > > > However, it seems that this test case is a little bit special. It
> > > > requires to initialize a ServerSocket to connect 0.0.0.0 after
> > > > connecting localhost successfully. If we use port 0 and 0.0.0.0at
> > the
> > > > same time, the ServerSocket constructed will be invalid.
> > > >
> > > > Thus, shall we assign a rarely-used port (e.g. 50000), or continue
> > using
> > > > Support_PortManager? Any ideas? Suggestions?
> > > >
> > > > --
> > > > Regards,
> > > >
> > > > Ruth Cao
> > > > China Software Development Lab, IBM
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Leo Li
> > > China Software Development Lab, IBM
> > >
> >
> >
> >
> > --
> > Best regards,
> > Andrew Zhang
> >
>
>
>
> --
> Leo Li
> China Software Development Lab, IBM
>
--
Best regards,
Andrew Zhang
--
Leo Li
China Software Development Lab, IBM