80 |
*/ |
*/ |
81 |
SocketImpl impl; |
SocketImpl impl; |
82 |
|
|
83 |
|
private boolean inputShutdown; |
84 |
|
private boolean outputShutdown; |
85 |
|
|
86 |
SocketChannel ch; // this field must have been set if created by SocketChannel |
SocketChannel ch; // this field must have been set if created by SocketChannel |
87 |
|
|
88 |
// Constructors |
// Constructors |
100 |
impl = factory.createSocketImpl(); |
impl = factory.createSocketImpl(); |
101 |
else |
else |
102 |
impl = new PlainSocketImpl(); |
impl = new PlainSocketImpl(); |
103 |
|
|
104 |
|
inputShutdown = false; |
105 |
|
outputShutdown = false; |
106 |
} |
} |
107 |
|
|
108 |
/** |
/** |
124 |
protected Socket (SocketImpl impl) throws SocketException |
protected Socket (SocketImpl impl) throws SocketException |
125 |
{ |
{ |
126 |
this.impl = impl; |
this.impl = impl; |
127 |
|
this.inputShutdown = false; |
128 |
|
this.outputShutdown = false; |
129 |
} |
} |
130 |
|
|
131 |
/** |
/** |
272 |
boolean stream) throws IOException |
boolean stream) throws IOException |
273 |
{ |
{ |
274 |
this(); |
this(); |
275 |
|
this.inputShutdown = false; |
276 |
|
this.outputShutdown = false; |
277 |
|
|
278 |
if (impl == null) |
if (impl == null) |
279 |
throw new IOException("Cannot initialize Socket implementation"); |
throw new IOException("Cannot initialize Socket implementation"); |
280 |
|
|
295 |
} |
} |
296 |
|
|
297 |
/** |
/** |
298 |
|
* Binds the socket to the givent local address/port |
299 |
|
* |
300 |
|
* @param bindpoint The address/port to bind to |
301 |
|
* |
302 |
|
* @exception IOException If an error occurs |
303 |
|
* @exception SecurityException If a security manager exists and its |
304 |
|
* checkConnect method doesn't allow the operation |
305 |
|
* @exception IllegalArgumentException If the address type is not supported |
306 |
|
* |
307 |
|
* @since 1.4 |
308 |
|
*/ |
309 |
|
public void bind (SocketAddress bindpoint) throws IOException |
310 |
|
{ |
311 |
|
} |
312 |
|
|
313 |
|
/** |
314 |
|
* Connects the socket with a remote address. |
315 |
|
* |
316 |
|
* @param endpoint The address to connect to |
317 |
|
* |
318 |
|
* @exception IOException If an error occurs |
319 |
|
* @exception IllegalArgumentException If the addess type is not supported |
320 |
|
* @exception IllegalBlockingModeException If this socket has an associated |
321 |
|
* channel, and the channel is in non-blocking mode |
322 |
|
* |
323 |
|
* @since 1.4 |
324 |
|
*/ |
325 |
|
public void connect (SocketAddress endpoint) |
326 |
|
throws IOException |
327 |
|
{ |
328 |
|
} |
329 |
|
|
330 |
|
/** |
331 |
|
* Connects the socket with a remote address. A timeout of zero is |
332 |
|
* interpreted as an infinite timeout. The connection will then block |
333 |
|
* until established or an error occurs. |
334 |
|
* |
335 |
|
* @param endpoint The address to connect to |
336 |
|
* |
337 |
|
* @exception IOException If an error occurs |
338 |
|
* @exception IllegalArgumentException If the address type is not supported |
339 |
|
* @exception IllegalBlockingModeException If this socket has an associated |
340 |
|
* channel, and the channel is in non-blocking mode |
341 |
|
* @exception SocketTimeoutException If the timeout is reached |
342 |
|
* |
343 |
|
* @since 1.4 |
344 |
|
*/ |
345 |
|
public void connect (SocketAddress endpoint, int timeout) |
346 |
|
throws IOException |
347 |
|
{ |
348 |
|
} |
349 |
|
|
350 |
|
/** |
351 |
* Returns the address of the remote end of the socket. If this socket |
* Returns the address of the remote end of the socket. If this socket |
352 |
* is not connected, then <code>null</code> is returned. |
* is not connected, then <code>null</code> is returned. |
353 |
* |
* |
586 |
} |
} |
587 |
|
|
588 |
/** |
/** |
589 |
|
* Sends urgent data through the socket |
590 |
|
* |
591 |
|
* @param data The data to send. |
592 |
|
* Only the lowest eight bits of data are sent |
593 |
|
* |
594 |
|
* @exception IOException If an error occurs |
595 |
|
* |
596 |
|
* @since 1.4 |
597 |
|
*/ |
598 |
|
public void sendUrgentData (int data) throws IOException |
599 |
|
{ |
600 |
|
} |
601 |
|
|
602 |
|
/** |
603 |
* Enables/disables the SO_OOBINLINE option |
* Enables/disables the SO_OOBINLINE option |
604 |
* |
* |
605 |
* @param on True if SO_OOBLINE should be enabled |
* @param on True if SO_OOBLINE should be enabled |
882 |
*/ |
*/ |
883 |
public void shutdownInput() throws IOException |
public void shutdownInput() throws IOException |
884 |
{ |
{ |
885 |
// impl.shutdownInput(); |
inputShutdown = true; |
886 |
} |
} |
887 |
|
|
888 |
/** |
/** |
892 |
*/ |
*/ |
893 |
public void shutdownOutput() throws IOException |
public void shutdownOutput() throws IOException |
894 |
{ |
{ |
895 |
// impl.shutdownOutput(); |
outputShutdown = true; |
896 |
} |
} |
897 |
|
|
898 |
/** |
/** |
1000 |
{ |
{ |
1001 |
return getLocalAddress () != null; |
return getLocalAddress () != null; |
1002 |
} |
} |
1003 |
|
|
1004 |
|
/** |
1005 |
|
* Checks if the socket's input stream is shutdown |
1006 |
|
*/ |
1007 |
|
public boolean isInputShutdown () |
1008 |
|
{ |
1009 |
|
return inputShutdown; |
1010 |
|
} |
1011 |
|
|
1012 |
|
/** |
1013 |
|
* Checks if the socket's output stream is shutdown |
1014 |
|
*/ |
1015 |
|
public boolean isOutputShutdown () |
1016 |
|
{ |
1017 |
|
return outputShutdown; |
1018 |
|
} |
1019 |
} |
} |