harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlana Samoilenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-507) [classlib] [net] java.net.Socket.connect(SocketAddress) throws unexpected ConnectException on Windows platform
Date Thu, 25 May 2006 04:57:29 GMT
[classlib] [net] java.net.Socket.connect(SocketAddress) throws unexpected  ConnectException
on Windows platform 
----------------------------------------------------------------------------------------------------------------

         Key: HARMONY-507
         URL: http://issues.apache.org/jira/browse/HARMONY-507
     Project: Harmony
        Type: Bug

  Components: Classlib  
    Reporter: Svetlana Samoilenko


Harmony does not connect with a server and throws  "java.net.ConnectException: ... - The address
is not available" in the trivial test while RI works fine.
Note, that on Linux there is no exception, only on Windows.

import java.net.*;

public class test  {
 public static void main(String [] args) { 
     int port =0;
     try{
        ServerSocket server = new ServerSocket(port);
        String host = server.getInetAddress().getHostName();
        port=server.getLocalPort();
        System.out.println("host="+host);
        System.out.println("port="+port);

        Socket client = new Socket();
        InetSocketAddress ia=new InetSocketAddress(host, port);
        System.out.println("ia.host="+ia.getHostName());
        System.out.println("ia.port="+ia.getPort());

        client.connect(ia);  
        System.out.println("client.isConnected="+client.isConnected());
     } catch (IOException e) {
        e.printStackTrace();
     };
   }
}
Output on RI:
host=0.0.0.0
port=3113
ia.host=0.0.0.0
ia.port=3113
client.isConnected=true

Output on Harmony (Windows):
host=0.0.0.0
port=3220
ia.host=0.0.0.0
ia.port=3220
java.net.ConnectException: 0.0.0.0/0.0.0.0:3220 - The address is not available
        at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:240)
        at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:605)
        at java.net.Socket.connect(Socket.java:951)
        at java.net.Socket.connect(Socket.java:898)
        at test.main(test.java:24)

	

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message