95 |
* might want this behavior. |
* might want this behavior. |
96 |
* |
* |
97 |
* @specnote This constructor is public since JDK 1.4 |
* @specnote This constructor is public since JDK 1.4 |
98 |
|
* @since 1.1 |
99 |
*/ |
*/ |
100 |
public Socket () |
public Socket () |
101 |
{ |
{ |
123 |
* <code>Socket</code> |
* <code>Socket</code> |
124 |
* |
* |
125 |
* @exception SocketException If an error occurs |
* @exception SocketException If an error occurs |
126 |
|
* |
127 |
|
* @since 1.1 |
128 |
*/ |
*/ |
129 |
protected Socket (SocketImpl impl) throws SocketException |
protected Socket (SocketImpl impl) throws SocketException |
130 |
{ |
{ |
183 |
* exists and does not allow a connection to the specified host/port or |
* exists and does not allow a connection to the specified host/port or |
184 |
* binding to the specified local host/port. |
* binding to the specified local host/port. |
185 |
* @exception IOException If a connection error occurs. |
* @exception IOException If a connection error occurs. |
186 |
|
* |
187 |
|
* @since 1.1 |
188 |
*/ |
*/ |
189 |
public Socket (String host, int port, |
public Socket (String host, int port, |
190 |
InetAddress localAddr, int localPort) throws IOException |
InetAddress localAddr, int localPort) throws IOException |
205 |
* @exception IOException If an error occurs |
* @exception IOException If an error occurs |
206 |
* @exception SecurityException If a security manager exists and its |
* @exception SecurityException If a security manager exists and its |
207 |
* checkConnect method doesn't allow the operation |
* checkConnect method doesn't allow the operation |
208 |
|
* |
209 |
|
* @since 1.1 |
210 |
*/ |
*/ |
211 |
public Socket (InetAddress address, int port, |
public Socket (InetAddress address, int port, |
212 |
InetAddress localAddr, int localPort) throws IOException |
InetAddress localAddr, int localPort) throws IOException |
403 |
* is not connected, then <code>null</code> is returned. |
* is not connected, then <code>null</code> is returned. |
404 |
* |
* |
405 |
* @return The local address |
* @return The local address |
406 |
|
* |
407 |
|
* @since 1.1 |
408 |
*/ |
*/ |
409 |
public InetAddress getLocalAddress () |
public InetAddress getLocalAddress () |
410 |
{ |
{ |
530 |
* @param on true to enable, false to disable |
* @param on true to enable, false to disable |
531 |
* |
* |
532 |
* @exception SocketException If an error occurs or Socket is not connected |
* @exception SocketException If an error occurs or Socket is not connected |
533 |
|
* |
534 |
|
* @since 1.1 |
535 |
*/ |
*/ |
536 |
public void setTcpNoDelay (boolean on) throws SocketException |
public void setTcpNoDelay (boolean on) throws SocketException |
537 |
{ |
{ |
550 |
* @return Whether or not TCP_NODELAY is set |
* @return Whether or not TCP_NODELAY is set |
551 |
* |
* |
552 |
* @exception SocketException If an error occurs or Socket not connected |
* @exception SocketException If an error occurs or Socket not connected |
553 |
|
* |
554 |
|
* @since 1.1 |
555 |
*/ |
*/ |
556 |
public boolean getTcpNoDelay() throws SocketException |
public boolean getTcpNoDelay() throws SocketException |
557 |
{ |
{ |
580 |
* |
* |
581 |
* @exception SocketException If an error occurs or Socket not connected |
* @exception SocketException If an error occurs or Socket not connected |
582 |
* @exception IllegalArgumentException If linger is negative |
* @exception IllegalArgumentException If linger is negative |
583 |
|
* |
584 |
|
* @since 1.1 |
585 |
*/ |
*/ |
586 |
public void setSoLinger(boolean on, int linger) throws SocketException |
public void setSoLinger(boolean on, int linger) throws SocketException |
587 |
{ |
{ |
617 |
* if SO_LINGER not set |
* if SO_LINGER not set |
618 |
* |
* |
619 |
* @exception SocketException If an error occurs or Socket is not connected |
* @exception SocketException If an error occurs or Socket is not connected |
620 |
|
* |
621 |
|
* @since 1.1 |
622 |
*/ |
*/ |
623 |
public int getSoLinger() throws SocketException |
public int getSoLinger() throws SocketException |
624 |
{ |
{ |
692 |
* this option implies that there is no timeout (ie, operations will |
* this option implies that there is no timeout (ie, operations will |
693 |
* block forever). On systems that have separate read and write timeout |
* block forever). On systems that have separate read and write timeout |
694 |
* values, this method returns the read timeout. This |
* values, this method returns the read timeout. This |
695 |
* value is in thousandths of a second (****????*****) |
* value is in thousandths of a second. |
696 |
* |
* |
697 |
* @param timeout The length of the timeout in thousandth's of a second or |
* @param timeout The length of the timeout in thousandths of a second, or |
698 |
* 0 if not set |
* 0 to indicate no timeout. |
699 |
* |
* |
700 |
* @exception SocketException If an error occurs or Socket not connected |
* @exception SocketException If an error occurs or Socket not connected |
701 |
|
* |
702 |
|
* @since 1.1 |
703 |
*/ |
*/ |
704 |
public synchronized void setSoTimeout (int timeout) throws SocketException |
public synchronized void setSoTimeout (int timeout) throws SocketException |
705 |
{ |
{ |
726 |
* if not set |
* if not set |
727 |
* |
* |
728 |
* @exception SocketException If an error occurs or Socket not connected |
* @exception SocketException If an error occurs or Socket not connected |
729 |
|
* |
730 |
|
* @since 1.1 |
731 |
*/ |
*/ |
732 |
public synchronized int getSoTimeout () throws SocketException |
public synchronized int getSoTimeout () throws SocketException |
733 |
{ |
{ |
843 |
* |
* |
844 |
* @exception SocketException If an error occurs or Socket is not connected |
* @exception SocketException If an error occurs or Socket is not connected |
845 |
* |
* |
846 |
* @since Java 1.3 |
* @since 1.3 |
847 |
*/ |
*/ |
848 |
public void setKeepAlive (boolean on) throws SocketException |
public void setKeepAlive (boolean on) throws SocketException |
849 |
{ |
{ |
861 |
* |
* |
862 |
* @exception SocketException If an error occurs or Socket is not connected |
* @exception SocketException If an error occurs or Socket is not connected |
863 |
* |
* |
864 |
* @since Java 1.3 |
* @since 1.3 |
865 |
*/ |
*/ |
866 |
public boolean getKeepAlive () throws SocketException |
public boolean getKeepAlive () throws SocketException |
867 |
{ |
{ |
939 |
* Closes the input side of the socket stream. |
* Closes the input side of the socket stream. |
940 |
* |
* |
941 |
* @exception IOException If an error occurs. |
* @exception IOException If an error occurs. |
942 |
|
* |
943 |
|
* @since 1.3 |
944 |
*/ |
*/ |
945 |
public void shutdownInput() throws IOException |
public void shutdownInput() throws IOException |
946 |
{ |
{ |
954 |
* Closes the output side of the socket stream. |
* Closes the output side of the socket stream. |
955 |
* |
* |
956 |
* @exception IOException If an error occurs. |
* @exception IOException If an error occurs. |
957 |
|
* |
958 |
|
* @since 1.3 |
959 |
*/ |
*/ |
960 |
public void shutdownOutput() throws IOException |
public void shutdownOutput() throws IOException |
961 |
{ |
{ |
969 |
* Returns the socket channel associated with this socket. |
* Returns the socket channel associated with this socket. |
970 |
* |
* |
971 |
* It returns null if no associated socket exists. |
* It returns null if no associated socket exists. |
972 |
|
* |
973 |
|
* @since 1.4 |
974 |
*/ |
*/ |
975 |
public SocketChannel getChannel() |
public SocketChannel getChannel() |
976 |
{ |
{ |
1059 |
|
|
1060 |
/** |
/** |
1061 |
* Checks if the socket is connected |
* Checks if the socket is connected |
1062 |
|
* |
1063 |
|
* @since 1.4 |
1064 |
*/ |
*/ |
1065 |
public boolean isConnected () |
public boolean isConnected () |
1066 |
{ |
{ |
1069 |
|
|
1070 |
/** |
/** |
1071 |
* Checks if the socket is already bound. |
* Checks if the socket is already bound. |
1072 |
|
* |
1073 |
|
* @since 1.4 |
1074 |
*/ |
*/ |
1075 |
public boolean isBound () |
public boolean isBound () |
1076 |
{ |
{ |
1079 |
|
|
1080 |
/** |
/** |
1081 |
* Checks if the socket is closed. |
* Checks if the socket is closed. |
1082 |
|
* |
1083 |
|
* @since 1.4 |
1084 |
*/ |
*/ |
1085 |
public boolean isClosed () |
public boolean isClosed () |
1086 |
{ |
{ |
1089 |
|
|
1090 |
/** |
/** |
1091 |
* Checks if the socket's input stream is shutdown |
* Checks if the socket's input stream is shutdown |
1092 |
|
* |
1093 |
|
* @since 1.4 |
1094 |
*/ |
*/ |
1095 |
public boolean isInputShutdown () |
public boolean isInputShutdown () |
1096 |
{ |
{ |
1099 |
|
|
1100 |
/** |
/** |
1101 |
* Checks if the socket's output stream is shutdown |
* Checks if the socket's output stream is shutdown |
1102 |
|
* |
1103 |
|
* @since 1.4 |
1104 |
*/ |
*/ |
1105 |
public boolean isOutputShutdown () |
public boolean isOutputShutdown () |
1106 |
{ |
{ |