291 |
if (sm != null) |
if (sm != null) |
292 |
sm.checkConnect(raddr.getHostName(), rport); |
sm.checkConnect(raddr.getHostName(), rport); |
293 |
|
|
294 |
|
// create socket |
295 |
impl.create(stream); |
impl.create(stream); |
296 |
|
|
297 |
|
// bind/connect to address/port |
298 |
// FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port, |
// FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port, |
299 |
// i.e. '0' and if localAddr is unspecified, use getLocalAddress() as |
// i.e. '0' and if localAddr is unspecified, use getLocalAddress() as |
300 |
// that default. JDK 1.2 doc infers not to do a bind. |
// that default. JDK 1.2 doc infers not to do a bind. |
301 |
if (laddr != null) |
if (laddr != null) { |
302 |
impl.bind(laddr, lport); |
try { |
303 |
|
impl.bind(laddr, lport); |
304 |
if (raddr != null) |
} catch (IOException exception) { |
305 |
impl.connect(raddr, rport); |
impl.close(); |
306 |
|
throw exception; |
307 |
|
} catch (RuntimeException exception) { |
308 |
|
impl.close(); |
309 |
|
throw exception; |
310 |
|
} catch (Error error) { |
311 |
|
impl.close(); |
312 |
|
throw error; |
313 |
|
} |
314 |
|
} |
315 |
|
if (raddr != null) { |
316 |
|
try { |
317 |
|
impl.connect(raddr, rport); |
318 |
|
} catch (IOException exception) { |
319 |
|
impl.close(); |
320 |
|
throw exception; |
321 |
|
} catch (RuntimeException exception) { |
322 |
|
impl.close(); |
323 |
|
throw exception; |
324 |
|
} catch (Error error) { |
325 |
|
impl.close(); |
326 |
|
throw error; |
327 |
|
} |
328 |
|
} |
329 |
} |
} |
330 |
|
|
331 |
/** |
/** |