我正在通过Follwing IP地址进行电话通信,但我不想以斜体的方式进行通信,但我如何能够改变<代码>。 InetAddress服务器Addr = InetAddress.getByName(“192.168.1.2”); to SSL.
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);
}
}
}