Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 75301 invoked from network); 18 Oct 2007 12:24:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Oct 2007 12:24:11 -0000 Received: (qmail 41293 invoked by uid 500); 18 Oct 2007 12:23:59 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 41269 invoked by uid 500); 18 Oct 2007 12:23:59 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 41258 invoked by uid 99); 18 Oct 2007 12:23:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2007 05:23:59 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2007 12:24:10 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 90E1E7141FE for ; Thu, 18 Oct 2007 05:23:50 -0700 (PDT) Message-ID: <22752702.1192710230581.JavaMail.jira@brutus> Date: Thu, 18 Oct 2007 05:23:50 -0700 (PDT) From: "Tim Ellison (JIRA)" To: commits@harmony.apache.org Subject: [jira] Assigned: (HARMONY-4961) SocketChannel.socket().getLocalPort() returns -1 from ServerSocketChannel In-Reply-To: <17076566.1192653651017.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tim Ellison reassigned HARMONY-4961: ------------------------------------ Assignee: Tim Ellison > SocketChannel.socket().getLocalPort() returns -1 from ServerSocketChannel > ------------------------------------------------------------------------- > > Key: HARMONY-4961 > URL: https://issues.apache.org/jira/browse/HARMONY-4961 > Project: Harmony > Issue Type: Bug > Components: Classlib > Environment: Reproduced on Windows XP SP2, on apache-harmony-jdk-r580985-windows-x86-32-snapshot > Reporter: Phil Loats > Assignee: Tim Ellison > > The following testcase fails onthe Harmony M3 snapshot build. > On J2SE 5.0, the output is "myport is 4321" > On Harmony M3 is "myport is -1" > It seems that SocketChannelImpl.isBound flag remains false when accessed from > SocketChannelImpl$SocketAdapter.isBound() from > SocketChannelImpl$SocketAdapter(Socket).getLocalPort() > We need this fix in an IBM product, I'd be most helpful if any fix can be clearly identified in SVN (i.e. don't lump other fixes with this fix). > =========simplified testcase=============== > import java.io.BufferedReader; > import java.io.IOException; > import java.io.InputStreamReader; > import java.net.InetAddress; > import java.net.InetSocketAddress; > import java.net.Socket; > import java.nio.channels.ServerSocketChannel; > import java.nio.channels.SocketChannel; > public class Test implements Runnable { > public static void main(String[] args) { > new Test().test(); > } > > void test() { > new Thread(this).start(); > > try { > // Create a non-blocking server socket channel on port > ServerSocketChannel ssChannel = ServerSocketChannel.open(); > ssChannel.configureBlocking(true); > int port = 4321; > ssChannel.socket().bind(new InetSocketAddress(port)); > // Accept the connection request > SocketChannel sChannel = ssChannel.accept(); > > if (sChannel != null) { > int myport = sChannel.socket().getLocalPort(); > System.out.println("myport is "+myport); > sChannel.close(); > } > } catch (IOException e) { > e.printStackTrace(); > } > } > public void run() { > try { > Thread.sleep(1000); > Socket socket = new Socket(InetAddress.getByName("localhost"), 4321); > BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream())); > String str; > while ((str = rd.readLine()) != null) { > System.out.println(str); > } > rd.close(); > } catch (Exception e) { > e.printStackTrace(); > } > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.