184 |
public void bind (SocketAddress endpoint) |
public void bind (SocketAddress endpoint) |
185 |
throws IOException |
throws IOException |
186 |
{ |
{ |
187 |
|
if (impl == null) |
188 |
|
throw new IOException ("Cannot initialize Socket implementation"); |
189 |
|
|
190 |
|
if (! (endpoint instanceof InetSocketAddress)) |
191 |
|
throw new IllegalArgumentException ("Address type not supported"); |
192 |
|
|
193 |
|
InetSocketAddress tmp = (InetSocketAddress) endpoint; |
194 |
|
|
195 |
|
SecurityManager s = System.getSecurityManager (); |
196 |
|
if (s != null) |
197 |
|
s.checkListen (tmp.getPort ()); |
198 |
|
|
199 |
|
impl.bind (tmp.getAddress (), tmp.getPort ()); |
200 |
} |
} |
201 |
|
|
202 |
/** |
/** |
214 |
*/ |
*/ |
215 |
public void bind (SocketAddress endpoint, int backlog) throws IOException |
public void bind (SocketAddress endpoint, int backlog) throws IOException |
216 |
{ |
{ |
217 |
|
if (impl == null) |
218 |
|
throw new IOException ("Cannot initialize Socket implementation"); |
219 |
|
|
220 |
|
if (! (endpoint instanceof InetSocketAddress)) |
221 |
|
throw new IllegalArgumentException ("Address type not supported"); |
222 |
|
|
223 |
|
InetSocketAddress tmp = (InetSocketAddress) endpoint; |
224 |
|
|
225 |
|
SecurityManager s = System.getSecurityManager (); |
226 |
|
if (s != null) |
227 |
|
s.checkListen (tmp.getPort ()); |
228 |
|
|
229 |
|
impl.bind (tmp.getAddress (), tmp.getPort ()); |
230 |
|
impl.listen(backlog); |
231 |
} |
} |
232 |
|
|
233 |
/** |
/** |