author | igerasim |
Tue, 27 Mar 2018 13:22:40 -0700 | |
changeset 49431 | 5812849b5027 |
parent 48911 | edaa989b4e67 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
48911
edaa989b4e67
8058965: Remove IPv6 support from TwoStacksPlainSocketImpl [win]
igerasim
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package java.net; |
|
26 |
||
27 |
import java.io.IOException; |
|
28 |
import java.io.FileDescriptor; |
|
10708
f255532bf336
7099488: TwoStacksPlainSocketImpl should invoke super.create(stream), typo in fix for 7098719
chegar
parents:
10704
diff
changeset
|
29 |
import sun.net.ResourceManager; |
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
30 |
import jdk.internal.misc.SharedSecrets; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
31 |
import jdk.internal.misc.JavaIOFileDescriptorAccess; |
2 | 32 |
|
33 |
/* |
|
48911
edaa989b4e67
8058965: Remove IPv6 support from TwoStacksPlainSocketImpl [win]
igerasim
parents:
47216
diff
changeset
|
34 |
* This class defines the plain SocketImpl that is used when |
edaa989b4e67
8058965: Remove IPv6 support from TwoStacksPlainSocketImpl [win]
igerasim
parents:
47216
diff
changeset
|
35 |
* the System property java.net.preferIPv4Stack is set to true. |
2 | 36 |
* |
37 |
* @author Chris Hegarty |
|
38 |
*/ |
|
39 |
||
48911
edaa989b4e67
8058965: Remove IPv6 support from TwoStacksPlainSocketImpl [win]
igerasim
parents:
47216
diff
changeset
|
40 |
class TwoStacksPlainSocketImpl extends AbstractPlainSocketImpl { |
2 | 41 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
42 |
private static final JavaIOFileDescriptorAccess fdAccess = |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
43 |
SharedSecrets.getJavaIOFileDescriptorAccess(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
44 |
|
18192 | 45 |
// true if this socket is exclusively bound |
46 |
private final boolean exclusiveBind; |
|
47 |
||
48 |
// emulates SO_REUSEADDR when exclusiveBind is true |
|
49 |
private boolean isReuseAddress; |
|
50 |
||
51 |
public TwoStacksPlainSocketImpl(boolean exclBind) { |
|
52 |
exclusiveBind = exclBind; |
|
53 |
} |
|
2 | 54 |
|
18192 | 55 |
public TwoStacksPlainSocketImpl(FileDescriptor fd, boolean exclBind) { |
2 | 56 |
this.fd = fd; |
18192 | 57 |
exclusiveBind = exclBind; |
2 | 58 |
} |
59 |
||
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
60 |
void socketCreate(boolean stream) throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
61 |
if (fd == null) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
62 |
throw new SocketException("Socket closed"); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
63 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
64 |
int newfd = socket0(stream, false /*v6 Only*/); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
65 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
66 |
fdAccess.set(fd, newfd); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
67 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
68 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
69 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
70 |
void socketConnect(InetAddress address, int port, int timeout) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
71 |
throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
72 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
73 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
74 |
if (address == null) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
75 |
throw new NullPointerException("inet address argument is null."); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
76 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
77 |
int connectResult; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
78 |
if (timeout <= 0) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
79 |
connectResult = connect0(nativefd, address, port); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
80 |
} else { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
81 |
configureBlocking(nativefd, false); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
82 |
try { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
83 |
connectResult = connect0(nativefd, address, port); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
84 |
if (connectResult == WOULDBLOCK) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
85 |
waitForConnect(nativefd, timeout); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
86 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
87 |
} finally { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
88 |
configureBlocking(nativefd, true); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
89 |
} |
2 | 90 |
} |
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
91 |
/* |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
92 |
* We need to set the local port field. If bind was called |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
93 |
* previous to the connect (by the client) then localport field |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
94 |
* will already be set. |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
95 |
*/ |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
96 |
if (localport == 0) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
97 |
localport = localPort0(nativefd); |
2 | 98 |
} |
99 |
||
18192 | 100 |
@Override |
101 |
void socketBind(InetAddress address, int port) throws IOException { |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
102 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
103 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
104 |
if (address == null) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
105 |
throw new NullPointerException("inet address argument is null."); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
106 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
107 |
bind0(nativefd, address, port, exclusiveBind); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
108 |
if (port == 0) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
109 |
localport = localPort0(nativefd); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
110 |
} else { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
111 |
localport = port; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
112 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
113 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
114 |
this.address = address; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
115 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
116 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
117 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
118 |
void socketListen(int backlog) throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
119 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
120 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
121 |
listen0(nativefd, backlog); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
122 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
123 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
124 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
125 |
void socketAccept(SocketImpl s) throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
126 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
127 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
128 |
if (s == null) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
129 |
throw new NullPointerException("socket is null"); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
130 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
131 |
int newfd = -1; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
132 |
InetSocketAddress[] isaa = new InetSocketAddress[1]; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
133 |
if (timeout <= 0) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
134 |
newfd = accept0(nativefd, isaa); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
135 |
} else { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
136 |
configureBlocking(nativefd, false); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
137 |
try { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
138 |
waitForNewConnection(nativefd, timeout); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
139 |
newfd = accept0(nativefd, isaa); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
140 |
if (newfd != -1) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
141 |
configureBlocking(newfd, true); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
142 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
143 |
} finally { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
144 |
configureBlocking(nativefd, true); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
145 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
146 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
147 |
/* Update (SocketImpl)s' fd */ |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
148 |
fdAccess.set(s.fd, newfd); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
149 |
/* Update socketImpls remote port, address and localport */ |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
150 |
InetSocketAddress isa = isaa[0]; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
151 |
s.port = isa.getPort(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
152 |
s.address = isa.getAddress(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
153 |
s.localport = localport; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
154 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
155 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
156 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
157 |
int socketAvailable() throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
158 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
159 |
return available0(nativefd); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
160 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
161 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
162 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
163 |
void socketClose0(boolean useDeferredClose/*unused*/) throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
164 |
if (fd == null) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
165 |
throw new SocketException("Socket closed"); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
166 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
167 |
if (!fd.valid()) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
168 |
return; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
169 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
170 |
final int nativefd = fdAccess.get(fd); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
171 |
fdAccess.set(fd, -1); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
172 |
close0(nativefd); |
18192 | 173 |
} |
174 |
||
175 |
@Override |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
176 |
void socketShutdown(int howto) throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
177 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
178 |
shutdown0(nativefd, howto); |
18192 | 179 |
} |
180 |
||
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
181 |
// Intentional fallthrough after SO_REUSEADDR |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
182 |
@SuppressWarnings("fallthrough") |
18192 | 183 |
@Override |
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
184 |
void socketSetOption(int opt, boolean on, Object value) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
185 |
throws SocketException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
186 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
187 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
188 |
if (opt == SO_TIMEOUT) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
189 |
// Don't enable the socket option on ServerSocket as it's |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
190 |
// meaningless (we don't receive on a ServerSocket). |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
191 |
if (serverSocket == null) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
192 |
setSoTimeout0(nativefd, ((Integer)value).intValue()); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
193 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
194 |
return; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
195 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
196 |
// SO_REUSEPORT is not supported on Windows. |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
197 |
if (opt == SO_REUSEPORT) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
198 |
throw new UnsupportedOperationException("unsupported option"); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
199 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
200 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
201 |
int optionValue = 0; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
202 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
203 |
switch(opt) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
204 |
case SO_REUSEADDR : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
205 |
if (exclusiveBind) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
206 |
// SO_REUSEADDR emulated when using exclusive bind |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
207 |
isReuseAddress = on; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
208 |
return; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
209 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
210 |
// intentional fallthrough |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
211 |
case TCP_NODELAY : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
212 |
case SO_OOBINLINE : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
213 |
case SO_KEEPALIVE : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
214 |
optionValue = on ? 1 : 0; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
215 |
break; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
216 |
case SO_SNDBUF : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
217 |
case SO_RCVBUF : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
218 |
case IP_TOS : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
219 |
optionValue = ((Integer)value).intValue(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
220 |
break; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
221 |
case SO_LINGER : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
222 |
if (on) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
223 |
optionValue = ((Integer)value).intValue(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
224 |
} else { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
225 |
optionValue = -1; |
10708
f255532bf336
7099488: TwoStacksPlainSocketImpl should invoke super.create(stream), typo in fix for 7098719
chegar
parents:
10704
diff
changeset
|
226 |
} |
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
227 |
break; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
228 |
default :/* shouldn't get here */ |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
229 |
throw new SocketException("Option not supported"); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
230 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
231 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
232 |
setIntOption(nativefd, opt, optionValue); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
233 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
234 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
235 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
236 |
int socketGetOption(int opt, Object iaContainerObj) throws SocketException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
237 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
238 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
239 |
// SO_BINDADDR is not a socket option. |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
240 |
if (opt == SO_BINDADDR) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
241 |
localAddress(nativefd, (InetAddressContainer)iaContainerObj); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
242 |
return 0; // return value doesn't matter. |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
243 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
244 |
// SO_REUSEPORT is not supported on Windows. |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
245 |
if (opt == SO_REUSEPORT) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
246 |
throw new UnsupportedOperationException("unsupported option"); |
2 | 247 |
} |
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
248 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
249 |
// SO_REUSEADDR emulated when using exclusive bind |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
250 |
if (opt == SO_REUSEADDR && exclusiveBind) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
251 |
return isReuseAddress? 1 : -1; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
252 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
253 |
int value = getIntOption(nativefd, opt); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
254 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
255 |
switch (opt) { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
256 |
case TCP_NODELAY : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
257 |
case SO_OOBINLINE : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
258 |
case SO_KEEPALIVE : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
259 |
case SO_REUSEADDR : |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
260 |
return (value == 0) ? -1 : 1; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
261 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
262 |
return value; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
263 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
264 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
265 |
@Override |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
266 |
void socketSendUrgentData(int data) throws IOException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
267 |
int nativefd = checkAndReturnNativeFD(); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
268 |
sendOOB(nativefd, data); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
269 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
270 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
271 |
private int checkAndReturnNativeFD() throws SocketException { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
272 |
if (fd == null || !fd.valid()) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
273 |
throw new SocketException("Socket closed"); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
274 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
275 |
return fdAccess.get(fd); |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
276 |
} |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
277 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
278 |
static final int WOULDBLOCK = -2; // Nothing available (non-blocking) |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
279 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
280 |
static { |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
281 |
initIDs(); |
2 | 282 |
} |
283 |
||
284 |
/* Native methods */ |
|
285 |
||
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
286 |
static native void initIDs(); |
2 | 287 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
288 |
static native int socket0(boolean stream, boolean v6Only) throws IOException; |
2 | 289 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
290 |
static native void bind0(int fd, InetAddress localAddress, int localport, |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
291 |
boolean exclBind) |
2 | 292 |
throws IOException; |
293 |
||
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
294 |
static native int connect0(int fd, InetAddress remote, int remotePort) |
2 | 295 |
throws IOException; |
296 |
||
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
297 |
static native void waitForConnect(int fd, int timeout) throws IOException; |
2 | 298 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
299 |
static native int localPort0(int fd) throws IOException; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
300 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
301 |
static native void localAddress(int fd, InetAddressContainer in) throws SocketException; |
2 | 302 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
303 |
static native void listen0(int fd, int backlog) throws IOException; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
304 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
305 |
static native int accept0(int fd, InetSocketAddress[] isaa) throws IOException; |
2 | 306 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
307 |
static native void waitForNewConnection(int fd, int timeout) throws IOException; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
308 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
309 |
static native int available0(int fd) throws IOException; |
2 | 310 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
311 |
static native void close0(int fd) throws IOException; |
2 | 312 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
313 |
static native void shutdown0(int fd, int howto) throws IOException; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
314 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
315 |
static native void setIntOption(int fd, int cmd, int optionValue) throws SocketException; |
2 | 316 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
317 |
static native void setSoTimeout0(int fd, int timeout) throws SocketException; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
318 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
319 |
static native int getIntOption(int fd, int cmd) throws SocketException; |
2 | 320 |
|
49431
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
321 |
static native void sendOOB(int fd, int data) throws IOException; |
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
322 |
|
5812849b5027
8198358: Align organization of TwoStacksPlainSocketImp with DualStackPlainSocketImpl [win]
igerasim
parents:
48911
diff
changeset
|
323 |
static native void configureBlocking(int fd, boolean blocking) throws IOException; |
2 | 324 |
} |