Source:
Solve real-time tracking debugging problem of mobile phone client.
Main Description:
It is mainly used to debug the collection of multi-terminal related log information function. Now LAN only. Use the extranet to ensure the mapping is correct.
such as. One app for multiple terminals at the same time. The embodiment of the test problem can be handled using this software.
The use of thread pooling on the software service side guarantees stability under large data volumes. In theory, any information interaction program that gives the socket is acceptable. Below are the Java client code that has been used for your reference.
Java Client Demo Code:
New Sendpclog (log). Start ();
Package cn.sj.soft;
Import java.io.IOException;
Import Java.io.OutputStream;
Import java.net.InetSocketAddress;
Import Java.net.socket;import
Java.net.SocketTimeoutException;
Import Java.net.URLEncoder;
/**
* Send log file to PC location error Android
* @author ZW
*/
public class Sendpclog extends Thread {
private static String HOST = "192.168.1.88";
private static int PORT = 19730;
static String buffer = "";
static socket socket = NULL;
Public String txt1;
Public Sendpclog (String str) {
Txt1 = android.os.build.model+ ":" +STR;
}
@Override
public void Run () {
Defining messages
try {
Connect to the server and set the connection timeout to 5 seconds
Socket = new socket ();
Socket.connect (New Inetsocketaddress (HOST, PORT), 5000);
Get input and output stream
OutputStream OU = Socket.getoutputstream ();
Sending information to the server
Ou.write (Urlencoder.encode (txt1, "Utf-8"). GetBytes ());
Ou.flush ();
Ou.close ();
Socket.close ();
} catch (Sockettimeoutexception aa) {
Bundle.putstring ("MSG", "Server Connection failed!") Please check if the network is turned on ");
} catch (IOException e) {
E.printstacktrace ();
}
}
}
Details: http://www.shijieweb.cn/post/1cc4ef53_40fc277
Category: World Jie series software original works
Give the socket an Android log collection program with Client call demo