1 |
/* Socket.java -- Client socket implementation |
/* Socket.java -- Client socket implementation |
2 |
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package java.net; |
package java.net; |
40 |
|
|
41 |
import gnu.java.net.PlainSocketImpl; |
import gnu.java.net.PlainSocketImpl; |
87 |
private boolean inputShutdown = false; |
private boolean inputShutdown = false; |
88 |
private boolean outputShutdown = false; |
private boolean outputShutdown = false; |
89 |
|
|
|
SocketChannel ch; // this field must have been set if created by SocketChannel |
|
|
|
|
90 |
private boolean closed = false; |
private boolean closed = false; |
91 |
|
|
92 |
/** |
/** |
296 |
// that default. JDK 1.2 doc infers not to do a bind. |
// that default. JDK 1.2 doc infers not to do a bind. |
297 |
} |
} |
298 |
|
|
|
/* |
|
|
* This method may only be used by java.nio.channels.ServerSocketChannel.accept and |
|
|
* java.nio.channels.SocketChannel.open. |
|
|
*/ |
|
|
void setChannel (SocketChannel ch) |
|
|
{ |
|
|
this.ch = ch; |
|
|
} |
|
|
|
|
299 |
/** |
/** |
300 |
* Binds the socket to the givent local address/port |
* Binds the socket to the givent local address/port |
301 |
* |
* |
390 |
if (! (endpoint instanceof InetSocketAddress)) |
if (! (endpoint instanceof InetSocketAddress)) |
391 |
throw new IllegalArgumentException ("Address type not supported"); |
throw new IllegalArgumentException ("Address type not supported"); |
392 |
|
|
393 |
if (ch != null && !ch.isBlocking ()) |
if (getChannel() != null |
394 |
|
&& !getChannel().isBlocking ()) |
395 |
throw new IllegalBlockingModeException (); |
throw new IllegalBlockingModeException (); |
396 |
|
|
397 |
if (!isBound ()) |
if (!isBound ()) |
872 |
if (impl != null) |
if (impl != null) |
873 |
impl.close(); |
impl.close(); |
874 |
|
|
875 |
if (ch != null) |
if (getChannel() != null) |
876 |
ch.close(); |
getChannel().close(); |
877 |
|
|
878 |
closed = true; |
closed = true; |
879 |
} |
} |
960 |
*/ |
*/ |
961 |
public SocketChannel getChannel() |
public SocketChannel getChannel() |
962 |
{ |
{ |
963 |
return ch; |
return null; |
964 |
} |
} |
965 |
|
|
966 |
/** |
/** |