harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victor A Martynov" <victor.marty...@gmail.com>
Subject Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);
Date Thu, 20 Jul 2006 12:06:21 GMT
Hello Mikhail,

Here are the results of running the modified test:
 -------------------------------------------------------------------

import java.net.*;


public class Test {

            public static void main(String args[]) throws Throwable {
                    ServerSocket ss = new ServerSocket(1099, 0,
InetAddress.getByName("0.0.0.0"));
                    System.out.println(ss.getInetAddress());
                    Socket s = new Socket("0.0.0.0", 1099);
            }
}
-------------------------------------------------------------------
c:\test>java Test
/0.0.0.0

c:\test>C:/Harmony/bin/ij -version
Apache Harmony DRLVM HEAD-4807 (2006-05-02), Windows/ia32/msvc 1310, debug

c:\test>C:/Harmony/bin/ij Test
/0.0.0.0
java.net.ConnectException: 0.0.0.0/0.0.0.0:1099 - The address is not
available
        at org.apache.harmony.luni.net.PlainSocketImpl.connect(
PlainSocketImpl.java:238)
        at org.apache.harmony.luni.net.PlainSocketImpl.connect(
PlainSocketImpl.java:200)
        at java.net.Socket.startupSocket(Socket.java:715)
        at java.net.Socket.<init>(Socket.java:139)
        at Test.main(Test.java:10)


=====
Warm Regards,

Victor Martynov,
Intel Middleware Product Division


On 7/20/06, Mikhail Fursov <mike.fursov@gmail.com> wrote:
>
> Add this line to the test to clarify the situation:
>                        System.out.println(ss.getInetAddress());
>
> I think that for PC with multiple network adapters serversocket IP must be
> specified manually.
>
>
> On 7/20/06, Victor A Martynov <victor.martynov@gmail.com> wrote:
> >
> > Hello,
> >
> > I'm having trouble with an application. This problem concerns creating
> > java.net.Socket on host "0.0.0.0".
> >
> > The test below illustrates this problem:
> >
> > import java.net.*;
> >
> >
> >
> > public class Test {
> >
> >
> >
> >             public static void main(String args[]) throws Throwable {
> >
> >                         ServerSocket ss = new ServerSocket(1099);
> >
> >                         Socket s = new Socket("0.0.0.0", 1099);
> >
> >             }
> >
> > }
> >
> > The output on RI and on Harmony differs:
> >
> > c:\test>java Test
> >
> > c:\test>C:/Harmony/bin/ij Test
> >
> > java.net.ConnectException: 0.0.0.0/0.0.0.0:1099 - The address is not
> > available
> >
> >         at org.apache.harmony.luni.net.PlainSocketImpl.connect(
> > PlainSocketImpl.java:238)
> >
> >         at org.apache.harmony.luni.net.PlainSocketImpl.connect(
> > PlainSocketImpl.java:200)
> >
> >         at java.net.Socket.startupSocket(Socket.java:715)
> >
> >         at java.net.Socket.<init>(Socket.java:139)
> >
> >         at Test.main(Test.java:7)
> >
> >
> >
> > I wonder whether it is a bug in RI or a bug in LUNI of Harmony?
> >
> > =====
> > Warm Regards,
> >
> > Victor Martynov,
> > Intel Middleware Product Division
> >
> >
>
>
> --
> Mikhail Fursov
>
>

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