title: how to do ssl socket programming
body: <p>I am doing socket communication through follwing  IP address it working but no i want to do communication in ssl mode but how can I change <code>InetAddress serverAddr = InetAddress.getByName("192.168.1.2");</code> to SSL.</p>
  
  <pre><code>public class TCPClient implements Runnable {
  
      public void run() {
  
       try {
  
           InetAddress serverAddr = InetAddress.getByName("192.168.1.2");
  
               Log.d("TCP", "C: Connecting...");
  
               Socket socket = new Socket(serverAddr,12345);
  
               String message = "Hello from Client android emulator";
                try {
  
                       Log.d("TCP", "C: Sending: '" + message + "'");
  
                       PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())),true);
  
                       out.println(message);
  
                       Log.d("TCP", "C: Sent.");
  
                   Log.d("TCP", "C: Done.");
  
  
  
           } catch(Exception e) {
  
               Log.e("TCP", "S: Error", e);
                   } finally {
  
                      socket.close();
  
                    }
       } catch (Exception e) {
  
            Log.e("TCP", "C: Error", e);
  
       }
  
  }
  
  }
  </code></pre>