jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java
changeset 25522 10d789df41bb
parent 23010 6dadb192ad81
equal deleted inserted replaced
25521:80551dd1d902 25522:10d789df41bb
   277     public Object getOption(int opt) throws SocketException {
   277     public Object getOption(int opt) throws SocketException {
   278         if (isClosedOrPending()) {
   278         if (isClosedOrPending()) {
   279             throw new SocketException("Socket Closed");
   279             throw new SocketException("Socket Closed");
   280         }
   280         }
   281         if (opt == SO_TIMEOUT) {
   281         if (opt == SO_TIMEOUT) {
   282             return new Integer(timeout);
   282             return timeout;
   283         }
   283         }
   284         int ret = 0;
   284         int ret = 0;
   285         /*
   285         /*
   286          * The native socketGetOption() knows about 3 options.
   286          * The native socketGetOption() knows about 3 options.
   287          * The 32 bit value it returns will be interpreted according
   287          * The 32 bit value it returns will be interpreted according
   297         case SO_OOBINLINE:
   297         case SO_OOBINLINE:
   298             ret = socketGetOption(opt, null);
   298             ret = socketGetOption(opt, null);
   299             return Boolean.valueOf(ret != -1);
   299             return Boolean.valueOf(ret != -1);
   300         case SO_LINGER:
   300         case SO_LINGER:
   301             ret = socketGetOption(opt, null);
   301             ret = socketGetOption(opt, null);
   302             return (ret == -1) ? Boolean.FALSE: (Object)(new Integer(ret));
   302             return (ret == -1) ? Boolean.FALSE: (Object)(ret);
   303         case SO_REUSEADDR:
   303         case SO_REUSEADDR:
   304             ret = socketGetOption(opt, null);
   304             ret = socketGetOption(opt, null);
   305             return Boolean.valueOf(ret != -1);
   305             return Boolean.valueOf(ret != -1);
   306         case SO_BINDADDR:
   306         case SO_BINDADDR:
   307             InetAddressContainer in = new InetAddressContainer();
   307             InetAddressContainer in = new InetAddressContainer();
   308             ret = socketGetOption(opt, in);
   308             ret = socketGetOption(opt, in);
   309             return in.addr;
   309             return in.addr;
   310         case SO_SNDBUF:
   310         case SO_SNDBUF:
   311         case SO_RCVBUF:
   311         case SO_RCVBUF:
   312             ret = socketGetOption(opt, null);
   312             ret = socketGetOption(opt, null);
   313             return new Integer(ret);
   313             return ret;
   314         case IP_TOS:
   314         case IP_TOS:
   315             ret = socketGetOption(opt, null);
   315             ret = socketGetOption(opt, null);
   316             if (ret == -1) { // ipv6 tos
   316             if (ret == -1) { // ipv6 tos
   317                 return new Integer(trafficClass);
   317                 return trafficClass;
   318             } else {
   318             } else {
   319                 return new Integer(ret);
   319                 return ret;
   320             }
   320             }
   321         case SO_KEEPALIVE:
   321         case SO_KEEPALIVE:
   322             ret = socketGetOption(opt, null);
   322             ret = socketGetOption(opt, null);
   323             return Boolean.valueOf(ret != -1);
   323             return Boolean.valueOf(ret != -1);
   324         // should never get here
   324         // should never get here