harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko" <alexey.a.petre...@gmail.com>
Subject Re: [classlib] Uncertain behavior of new Socket("0.0.0.0", 1099);
Date Thu, 20 Jul 2006 13:43:11 GMT
2006/7/20, Alexey Petrenko <alexey.a.petrenko@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 <mike.fursov@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 <victor.martynov@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 <mark.hindess@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


Mime
View raw message