From owner-freebsd-java@FreeBSD.ORG Tue May 28 12:06:08 2013 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DA3D2E57 for ; Tue, 28 May 2013 12:06:08 +0000 (UTC) (envelope-from yerenkow@gmail.com) Received: from mail-pb0-x22e.google.com (mail-pb0-x22e.google.com [IPv6:2607:f8b0:400e:c01::22e]) by mx1.freebsd.org (Postfix) with ESMTP id B9A10319 for ; Tue, 28 May 2013 12:06:08 +0000 (UTC) Received: by mail-pb0-f46.google.com with SMTP id rq2so7794116pbb.33 for ; Tue, 28 May 2013 05:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=theWMsQVnGBjgCT2JWKJgrrmdMabYFPQowZMg4rGb0g=; b=Gb+tQ/A4i861bGVgq/1b+iLXjpyo1ZeBcWW8dR4Gg05oDsiXKp3MP6XDxzEZ1Lqdoz G+d45t6+eo8NFIujfAfRaDuh+mG1RBjali7fHzu6Enh2MC7YO4N8iRl4+zP1ZvNDi71k y5H8IBb8bGyBy2jywrdDN1+Bo3Ob0X7SeeKl1UP4Hz0sbv844a1cuXQ5vDRDp0+JeruQ 3pttZUh+H1t1lNBpS9+Iz2aerQWQwRWoCv6OeMCXMqiF66AnR7hf60N7Kq7T0pElZT0j XZXY7lLLZa8ExcJGY0rMRdmmLxvscbn2DMXPy+HZ+YDo9NBsgf/zwQV7Ww17fInO0obA MJrw== MIME-Version: 1.0 X-Received: by 10.67.5.8 with SMTP id ci8mr33535663pad.48.1369742768494; Tue, 28 May 2013 05:06:08 -0700 (PDT) Received: by 10.68.239.103 with HTTP; Tue, 28 May 2013 05:06:08 -0700 (PDT) In-Reply-To: <20130528120123.GA1687@tiny.Sisis.de> References: <20130528120123.GA1687@tiny.Sisis.de> Date: Tue, 28 May 2013 15:06:08 +0300 Message-ID: Subject: Re: java && IPv6 From: Alexander Yerenkow To: Matthias Apitz Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-java@freebsd.org X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2013 12:06:08 -0000 Did your jdk built with ipv6 support? 2013/5/28 Matthias Apitz > > Hello, > > I'm a C-programmer and want to do something in Java now; > > I want to write an IPv6 server in java which should do what my C written > IPv6-server does: > > - create the two sockets for IPv4 and IPv6 > - bind, listen > - monitor the sockets with "poll" and accept the connection on the > socket which is ready to be accepted; > > see the C-source at http://www.unixarea.de/ipv6-server.c.txt > it can be compiled and run and creates LISTEN on the two sockets, see > netstat output: > > ~/c]$ gcc ipv6-server.c > ~/c]$ ./a.out > family: 28 (PF_INET6) sin6_addr: [::] > LISTEN: IPv6 ... > family: 2 (PF_INET) sin_addr: [0.0.0.0] > LISTEN: IPv4 ... > > ~/c]$ netstat -an | fgrep 39999 > tcp4 0 0 *.39999 *.* LISTEN > tcp6 0 0 *.39999 *.* LISTEN > > when I do something similar on the same FreeBSD host in Java, I can't > manage to create the IPv6 LISTEN on the IP addr "::"; IPv4 works fine, > when I use as addr 'null'; > the source is here: http://www.unixarea.de/ipv6.java.txt > > ~/java]$ javac ipv6.java > ~/java]$ java -version > java version "1.6.0_03-p4" > Java(TM) SE Runtime Environment (build > 1.6.0_03-p4-guru_22_apr_2011_14_10-b00) > Java HotSpot(TM) Client VM (build 1.6.0_03-p4-guru_22_apr_2011_14_10-b00, > mixed mode) > ~/java]$ java -Djava.net.preferIPv6Stack=true ipv6 > java.net.SocketException: Protocol family unavailable > at java.net.PlainSocketImpl.socketBind(Native Method) > at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) > at java.net.ServerSocket.bind(ServerSocket.java:319) > at java.net.ServerSocket.(ServerSocket.java:185) > at ipv6$1.run(ipv6.java:18) > at java.lang.Thread.run(Thread.java:619) > > Any Java guru out here? Any comments on my Java class? Thanks > > matthias > > -- > Sent from my FreeBSD netbook > > Matthias Apitz | - No system with backdoors like > Apple/Android > E-mail: guru@unixarea.de | - Never being an iSlave > WWW: http://www.unixarea.de/ | - No proprietary attachments, no HTML/RTF > in E-mail > phone: +49-170-4527211 | - Respect for open standards > _______________________________________________ > freebsd-java@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org" > -- Regards, Alexander Yerenkow