1 /* |
1 /* |
2 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 2016, 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 |
171 protected void connect(SocketAddress address, int timeout) throws IOException { |
171 protected void connect(SocketAddress address, int timeout) throws IOException { |
172 impl.connect(address, timeout); |
172 impl.connect(address, timeout); |
173 } |
173 } |
174 |
174 |
175 public void setOption(int opt, Object val) throws SocketException { |
175 public void setOption(int opt, Object val) throws SocketException { |
|
176 if (opt == SocketOptions.SO_REUSEPORT) { |
|
177 // SO_REUSEPORT is not supported on Windows. |
|
178 throw new UnsupportedOperationException("unsupported option"); |
|
179 } |
176 impl.setOption(opt, val); |
180 impl.setOption(opt, val); |
177 } |
181 } |
178 |
182 |
179 public Object getOption(int opt) throws SocketException { |
183 public Object getOption(int opt) throws SocketException { |
|
184 if (opt == SocketOptions.SO_REUSEPORT) { |
|
185 // SO_REUSEPORT is not supported on Windows. |
|
186 throw new UnsupportedOperationException("unsupported option"); |
|
187 } |
180 return impl.getOption(opt); |
188 return impl.getOption(opt); |
181 } |
189 } |
182 |
190 |
183 synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException { |
191 synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException { |
184 impl.doConnect(address, port, timeout); |
192 impl.doConnect(address, port, timeout); |
330 impl.socketShutdown(howto); |
338 impl.socketShutdown(howto); |
331 } |
339 } |
332 |
340 |
333 void socketSetOption(int cmd, boolean on, Object value) |
341 void socketSetOption(int cmd, boolean on, Object value) |
334 throws SocketException { |
342 throws SocketException { |
|
343 if (cmd == SocketOptions.SO_REUSEPORT) { |
|
344 // SO_REUSEPORT is not supported on Windows. |
|
345 throw new UnsupportedOperationException("unsupported option"); |
|
346 } |
335 impl.socketSetOption(cmd, on, value); |
347 impl.socketSetOption(cmd, on, value); |
336 } |
348 } |
337 |
349 |
338 int socketGetOption(int opt, Object iaContainerObj) throws SocketException { |
350 int socketGetOption(int opt, Object iaContainerObj) throws SocketException { |
|
351 if (opt == SocketOptions.SO_REUSEPORT) { |
|
352 // SO_REUSEPORT is not supported on Windows. |
|
353 throw new UnsupportedOperationException("unsupported option"); |
|
354 } |
339 return impl.socketGetOption(opt, iaContainerObj); |
355 return impl.socketGetOption(opt, iaContainerObj); |
340 } |
356 } |
341 |
357 |
342 void socketSendUrgentData(int data) throws IOException { |
358 void socketSendUrgentData(int data) throws IOException { |
343 impl.socketSendUrgentData(data); |
359 impl.socketSendUrgentData(data); |
344 } |
360 } |
|
361 |
|
362 static boolean isReusePortAvailable() { |
|
363 // SO_REUSEPORT is not supported on Windows. |
|
364 return false; |
|
365 } |
345 } |
366 } |