You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Petrenko (JIRA)" <ji...@apache.org> on 2006/08/07 15:27:14 UTC

[jira] Commented: (HARMONY-507) [classlib] [net] java.net.Socket.connect(SocketAddress) throws unexpected ConnectException on Windows platform

    [ http://issues.apache.org/jira/browse/HARMONY-507?page=comments#action_12426212 ] 
            
Alexey Petrenko commented on HARMONY-507:
-----------------------------------------

This issue is duplicate of JIRA 946 and should be closed.

> [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
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Svetlana Samoilenko
>         Attachments: SocketTest.java
>
>
> 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