diff --git a/examples/src/TcpExamples/TcpExample3Client.java b/examples/src/TcpExamples/TcpExample3Client.java
index a5841c8d2804b061eca53741ddd6943b9b660d74..cb346fa0833a42238dbbf1e723314ebbb7980126 100644
--- a/examples/src/TcpExamples/TcpExample3Client.java
+++ b/examples/src/TcpExamples/TcpExample3Client.java
@@ -22,7 +22,7 @@ public class TcpExample3Client {
     public static void main(String[] args) {
         
         // Local variables/fields
-        Socket socket;
+        Socket socket = null;
         InputStream is;
         InputStreamReader isr;
         BufferedReader br;
@@ -72,6 +72,11 @@ public class TcpExample3Client {
         }
         finally // occurs after any other activity when shutting down
         {
+            try {
+                if (socket != null)
+                    socket.close();
+            } catch (IOException e) {}
+            
             // program exit: tell somebody about that happening.  Likely cause: server drops connection.
             System.out.println();
             System.out.println("TcpExample3Client exit");