src/java.base/unix/native/libnio/ch/Net.c
changeset 49141 ac95c7a76132
parent 47216 71c04702a3d5
child 49417 1d3139252c1c
equal deleted inserted replaced
49140:9ffbe8258541 49141:ac95c7a76132
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   291 {
   291 {
   292     SOCKETADDRESS sa;
   292     SOCKETADDRESS sa;
   293     int sa_len = 0;
   293     int sa_len = 0;
   294     int rv;
   294     int rv;
   295 
   295 
   296     if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len,
   296     if (NET_InetAddressToSockaddr(env, iao, port, &sa, &sa_len, preferIPv6) != 0) {
   297                                   preferIPv6) != 0) {
       
   298         return IOS_THROWN;
   297         return IOS_THROWN;
   299     }
   298     }
   300 
   299 
   301     rv = connect(fdval(env, fdo), &sa.sa, sa_len);
   300     rv = connect(fdval(env, fdo), &sa.sa, sa_len);
   302     if (rv != 0) {
   301     if (rv != 0) {
   759         case EPROTO:
   758         case EPROTO:
   760             xn = JNU_JAVANETPKG "ProtocolException";
   759             xn = JNU_JAVANETPKG "ProtocolException";
   761             break;
   760             break;
   762 #endif
   761 #endif
   763         case ECONNREFUSED:
   762         case ECONNREFUSED:
       
   763         case ETIMEDOUT:
       
   764         case ENOTCONN:
   764             xn = JNU_JAVANETPKG "ConnectException";
   765             xn = JNU_JAVANETPKG "ConnectException";
   765             break;
   766             break;
   766         case ETIMEDOUT:
   767 
   767             xn = JNU_JAVANETPKG "ConnectException";
       
   768             break;
       
   769         case EHOSTUNREACH:
   768         case EHOSTUNREACH:
   770             xn = JNU_JAVANETPKG "NoRouteToHostException";
   769             xn = JNU_JAVANETPKG "NoRouteToHostException";
   771             break;
   770             break;
   772         case EADDRINUSE:  /* Fall through */
   771         case EADDRINUSE:  /* Fall through */
   773         case EADDRNOTAVAIL:
   772         case EADDRNOTAVAIL: