summaryrefslogtreecommitdiff
path: root/java/net/Socket.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/net/Socket.java')
-rw-r--r--java/net/Socket.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/net/Socket.java b/java/net/Socket.java
index 6708232e9..ec390a3bd 100644
--- a/java/net/Socket.java
+++ b/java/net/Socket.java
@@ -297,6 +297,17 @@ Socket(InetAddress raddr, int rport, InetAddress laddr, int lport,
*/
/**
+ * This method closes the socket when this object is garbage collected
+ */
+protected void
+finalize() throws IOException
+{
+ close();
+}
+
+/*************************************************************************/
+
+/**
* Closes the socket.
*
* @exception IOException If an error occurs