You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Victor A Martynov <vi...@gmail.com> on 2006/07/20 13:34:58 UTC

[classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

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

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Alexey Petrenko <al...@gmail.com>.
I've attached a fix for this issue.

SY, Alexey

2006/7/21, Victor A Martynov <vi...@gmail.com>:
>  Hello Geir,
>
> I created new JIRA:
>
> HARMONY-946
>
> on this issue.
>
>
> =====
> Warm Regards,
>
> Victor Martynov,
> Intel Middleware Product Division
>
>
>
> On 7/20/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
> >
> > We have a bug.  0.0.0.0 should be all adapters, and is legit.
> > Can you file a JIRA?
> >
> > Victor A Martynov wrote:
> > > 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 <mi...@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 <vi...@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
> > >>
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
>


-- 
Alexey A. Petrenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Victor A Martynov <vi...@gmail.com>.
 Hello Geir,

I created new JIRA:

HARMONY-946

on this issue.


=====
Warm Regards,

Victor Martynov,
Intel Middleware Product Division



On 7/20/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
>
> We have a bug.  0.0.0.0 should be all adapters, and is legit.
> Can you file a JIRA?
>
> Victor A Martynov wrote:
> > 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 <mi...@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 <vi...@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
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Geir Magnusson Jr <ge...@pobox.com>.
We have a bug.  0.0.0.0 should be all adapters, and is legit.
Can you file a JIRA?

Victor A Martynov wrote:
> 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 <mi...@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 <vi...@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
>>
>>
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Victor A Martynov <vi...@gmail.com>.
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 <mi...@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 <vi...@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
>
>

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Andrew Zhang <zh...@gmail.com>.
On 7/20/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
>
>
>
> Mikhail Fursov 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.
>
> I don't think so.  "0.0.0.0" should mean all of them, right?


Yes. a socket listens on "0.0.0.0" means on it listens on all of network
interfaces on this machine. It's often used for binding function.
But the behaviour of connecting to "0.0.0.0" is unspeicified. At least,
windows treats it as invalid target address, while linux allows it.

geir

>
>
> On 7/20/06, Victor A Martynov <vi...@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
>>
>>
>
>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org





-- 
Andrew Zhang
China Software Development Lab, IBM

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Mikhail Fursov <mi...@gmail.com>.
Yes, you're right - any of them.

BTW I tried to build debug version of classlib to have HYSOCKDEBUG enabled
and have a problem with build (lack of experience)
I tried to add -DDEBUG flag to classlib\trunk\depends\build\defines.mak and
rerun ant build but nothing was rebuilded.
What is the right way to rebuild classlib to enable logging like
HYSOCKDEBUG?


On 7/20/06, Geir Magnusson Jr <ge...@pobox.com> wrote:
>
>
>
> Mikhail Fursov 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.
>
> I don't think so.  "0.0.0.0" should mean all of them, right?
>
> geir
>
> >
> >
> > On 7/20/06, Victor A Martynov <vi...@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
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Mikhail Fursov

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Geir Magnusson Jr <ge...@pobox.com>.

Mikhail Fursov 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.

I don't think so.  "0.0.0.0" should mean all of them, right?

geir

> 
> 
> On 7/20/06, Victor A Martynov <vi...@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
>>
>>
> 
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Mikhail Fursov <mi...@gmail.com>.
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 <vi...@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

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Andrew Zhang <zh...@gmail.com>.
On 7/20/06, Mikhail Fursov <mi...@gmail.com> wrote:
>
> The documentation of java.net.Socket says nothing about 0.0.0.0 address,
> but documentation on java.net.DatagramSocket has a reference to it:
> http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramSocket.html
> "If the IP address is 0.0.0.0, the socket will be bound to the wildcard
> address, an IP address chosen by the kernel."


Hello Mikhail, they are different. New DatagramSocket("0.0.0.0",port) means
the datagram socket will be bound to "0.0.0.0", but new Socket("0.0.0.0",port)
means new a socket bound with a system free port and then connect to ("
0.0.0.0", port).

I didn't investigate Harmony implementation code, but I guess it's caused by
difference of system call. On windows, 0.0.0.0 is regarded as a "invalid
address", while on Linux, it's valid.
I'll take a deep look at the code later on.

So it's normal to use 0.0.0.0 and we have a bug.


Agree. I think we should follow RI this time.

On 7/20/06, Victor A Martynov <vi...@gmail.com> wrote:
> >
> > Hello Mark,
> >
> > I run the example on MS Windows XP, Harmony classlib+DRLVM dated 11 july
> > 2006.
> >
> > c:\test>c:\Harmony\bin\ij -version
> > Apache Harmony DRLVM HEAD-4807 (2006-05-02), Windows/ia32/msvc 1310,
> debug
> >
> > =====
> > Warm Regards,
> >
> > Victor Martynov,
> > Intel Middleware Product Division
> >
> >
> > On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
> > >
> > >
> > > On 20 July 2006 at 15:34, "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".
> > >
> > > What platform?  Works for me on Linux (debian testing).
> > >
> > > -Mark.
> > >
> > > > 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
> > > >
> > > > ------=_Part_57416_17500570.1153395298489--
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > >
> > >
> >
> >
>
>
> --
> Mikhail Fursov
>
>


-- 
Andrew Zhang
China Software Development Lab, IBM

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Alexei Zakharov <al...@gmail.com>.
Hi Mikhail,

I don't think this description of DatagramSocket constructor is
somehow applicable to the Victor's example. In this description we
deal with *local* address to bind DatagramSocket to (to receive
DatagramPackets). But in the example above 0.0.0.0 is used as a
*destination* address for plain Socket to establish a connection to.
This is the completely different case IMHO. BTW, I'm not sure it is
possible to establish a connection to a wildcard address.

Regards,

2006/7/20, Mikhail Fursov <mi...@gmail.com>:
> The documentation of java.net.Socket says nothing about 0.0.0.0 address,
> but documentation on java.net.DatagramSocket has a reference to it:
> http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramSocket.html
> "If the IP address is 0.0.0.0, the socket will be bound to the wildcard
> address, an IP address chosen by the kernel."
>
> So it's normal to use 0.0.0.0 and we have a bug.
>
>
> On 7/20/06, Victor A Martynov <vi...@gmail.com> wrote:
> >
> > Hello Mark,
> >
> > I run the example on MS Windows XP, Harmony classlib+DRLVM dated 11 july
> > 2006.
> >
> > c:\test>c:\Harmony\bin\ij -version
> > Apache Harmony DRLVM HEAD-4807 (2006-05-02), Windows/ia32/msvc 1310, debug
> >
> > =====
> > Warm Regards,
> >
> > Victor Martynov,
> > Intel Middleware Product Division
> >
> >
> > On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
> > >
> > >
> > > On 20 July 2006 at 15:34, "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".
> > >
> > > What platform?  Works for me on Linux (debian testing).
> > >
> > > -Mark.
> > >
> > > > 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
> > > >
> > > > ------=_Part_57416_17500570.1153395298489--
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > >
> > >
> >
> >
>
>
> --
> Mikhail Fursov
>
>


-- 
Alexei Zakharov,
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Alexey Petrenko <al...@gmail.com>.
2006/7/20, Alexey Petrenko <al...@gmail.com>:
> That's a different types of sockets. You specify address to BIND for
> DatagramSocket and address to CONNECT for Socket.
> Address to bind can be chosen by underlying system.
> But how do you suggest to choose address to connect? :)
>
> I'll check the IP protocol spec for the meaning of 0.0.0.0 address. If
> there is any...
I could not find anything in the IP spec. But C headers defines
0.0.0.0 as a value for INADDR_ANY constant... Ant it is used to bind a
socket to all the local addresses.

So I think that exception is OK here.

SY, Alexey

> 2006/7/20, Mikhail Fursov <mi...@gmail.com>:
> > The documentation of java.net.Socket says nothing about 0.0.0.0 address,
> > but documentation on java.net.DatagramSocket has a reference to it:
> > http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramSocket.html
> > "If the IP address is 0.0.0.0, the socket will be bound to the wildcard
> > address, an IP address chosen by the kernel."
> >
> > So it's normal to use 0.0.0.0 and we have a bug.
> >
> >
> > On 7/20/06, Victor A Martynov <vi...@gmail.com> wrote:
> > >
> > > Hello Mark,
> > >
> > > I run the example on MS Windows XP, Harmony classlib+DRLVM dated 11 july
> > > 2006.
> > >
> > > c:\test>c:\Harmony\bin\ij -version
> > > Apache Harmony DRLVM HEAD-4807 (2006-05-02), Windows/ia32/msvc 1310, debug
> > >
> > > =====
> > > Warm Regards,
> > >
> > > Victor Martynov,
> > > Intel Middleware Product Division
> > >
> > >
> > > On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
> > > >
> > > >
> > > > On 20 July 2006 at 15:34, "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".
> > > >
> > > > What platform?  Works for me on Linux (debian testing).
> > > >
> > > > -Mark.
> > > >
> > > > > 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
> > > > >
> > > > > ------=_Part_57416_17500570.1153395298489--
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Mikhail Fursov
> >
> >
>
>
> --
> Alexey A. Petrenko
> Intel Middleware Products Division
>


-- 
Alexey A. Petrenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Alexey Petrenko <al...@gmail.com>.
That's a different types of sockets. You specify address to BIND for
DatagramSocket and address to CONNECT for Socket.
Address to bind can be chosen by underlying system.
But how do you suggest to choose address to connect? :)

I'll check the IP protocol spec for the meaning of 0.0.0.0 address. If
there is any...

SY, Alexey

2006/7/20, Mikhail Fursov <mi...@gmail.com>:
> The documentation of java.net.Socket says nothing about 0.0.0.0 address,
> but documentation on java.net.DatagramSocket has a reference to it:
> http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramSocket.html
> "If the IP address is 0.0.0.0, the socket will be bound to the wildcard
> address, an IP address chosen by the kernel."
>
> So it's normal to use 0.0.0.0 and we have a bug.
>
>
> On 7/20/06, Victor A Martynov <vi...@gmail.com> wrote:
> >
> > Hello Mark,
> >
> > I run the example on MS Windows XP, Harmony classlib+DRLVM dated 11 july
> > 2006.
> >
> > c:\test>c:\Harmony\bin\ij -version
> > Apache Harmony DRLVM HEAD-4807 (2006-05-02), Windows/ia32/msvc 1310, debug
> >
> > =====
> > Warm Regards,
> >
> > Victor Martynov,
> > Intel Middleware Product Division
> >
> >
> > On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
> > >
> > >
> > > On 20 July 2006 at 15:34, "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".
> > >
> > > What platform?  Works for me on Linux (debian testing).
> > >
> > > -Mark.
> > >
> > > > 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
> > > >
> > > > ------=_Part_57416_17500570.1153395298489--
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > >
> > >
> >
> >
>
>
> --
> Mikhail Fursov
>
>


-- 
Alexey A. Petrenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Mikhail Fursov <mi...@gmail.com>.
The documentation of java.net.Socket says nothing about 0.0.0.0 address,
but documentation on java.net.DatagramSocket has a reference to it:
http://java.sun.com/j2se/1.4.2/docs/api/java/net/DatagramSocket.html
"If the IP address is 0.0.0.0, the socket will be bound to the wildcard
address, an IP address chosen by the kernel."

So it's normal to use 0.0.0.0 and we have a bug.


On 7/20/06, Victor A Martynov <vi...@gmail.com> wrote:
>
> Hello Mark,
>
> I run the example on MS Windows XP, Harmony classlib+DRLVM dated 11 july
> 2006.
>
> c:\test>c:\Harmony\bin\ij -version
> Apache Harmony DRLVM HEAD-4807 (2006-05-02), Windows/ia32/msvc 1310, debug
>
> =====
> Warm Regards,
>
> Victor Martynov,
> Intel Middleware Product Division
>
>
> On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
> >
> >
> > On 20 July 2006 at 15:34, "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".
> >
> > What platform?  Works for me on Linux (debian testing).
> >
> > -Mark.
> >
> > > 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
> > >
> > > ------=_Part_57416_17500570.1153395298489--
> >
> >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
>


-- 
Mikhail Fursov

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Victor A Martynov <vi...@gmail.com>.
Hello Mark,

I run the example on MS Windows XP, Harmony classlib+DRLVM dated 11 july
2006.

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

=====
Warm Regards,

Victor Martynov,
Intel Middleware Product Division


On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
>
>
> On 20 July 2006 at 15:34, "Victor A Martynov" <vi...@gmail.com>
> wrote:
> >
> > Hello,
> >
> >  I'm having trouble with an application. This problem concerns creating
> > java.net.Socket on host "0.0.0.0".
>
> What platform?  Works for me on Linux (debian testing).
>
> -Mark.
>
> > 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
> >
> > ------=_Part_57416_17500570.1153395298489--
>
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);

Posted by Victor A Martynov <vi...@gmail.com>.
Hello Mark,

I checked the behavior of the test on Linux. It seems that the problem
exists on MS Windows only:

----------------------------------------------------------------------------------------------------------------------
vamartyn@server:~> uname -a
Linux server 2.6.5-7.145lxset1-smp #1 SMP Thu Jan 27 09:19:29 UTC 2005 i686
i686 i386 GNU/Linux
vamartyn@server:~> Harmony/bin/ij -version
Apache Harmony DRLVM HEAD-4807 (2006-05-02), Linux/ia32/gcc 3.3.4, debug
vamartyn@server:~> Harmony/bin/ij Test
/0.0.0.0
vamartyn@server:~> java Test
/0.0.0.0
vamartyn@server:~>
----------------------------------------------------------------------------------------------------------------------

The fact that Windows and Linux version behavior is different makes me think
that it is a bug in LUNI rather than the bug in RI.

=====
Warm Regards,

Victor Martynov,
Intel Middleware Product Division


On 7/20/06, Mark Hindess <ma...@googlemail.com> wrote:
>
>
> On 20 July 2006 at 15:34, "Victor A Martynov" <vi...@gmail.com>
> wrote:
> >
> > Hello,
> >
> >  I'm having trouble with an application. This problem concerns creating
> > java.net.Socket on host "0.0.0.0".
>
> What platform?  Works for me on Linux (debian testing).
>
> -Mark.
>
> > 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
> >
> > ------=_Part_57416_17500570.1153395298489--
>
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>