📄 client.java
字号:
package com.sxit.wap.sncs;
/**
* <p>Title: wap II</p>
* <p>Description:运行在服务器上 </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: sxit</p>
* @author not attributable
* @version 1.0
*/
import java.io.*;
import org.jdom.input.*;
import org.jdom.output.*;
import org.jdom.*;
import java.util.Vector;
public class Client {
private static Vector list = null;
private static Thread thread = null;
public synchronized void tellListReflesh () {
list = null;
}
public synchronized Vector getList(){
if ( list == null )
list = new NetNoteManager ().getNetNotes ();
return list;
}
public synchronized void start(){
if (thread ==null){
thread = new ClientThread(this);
thread.start();
}
}
public Client() {
}
public static void main(String[] args) {
Client client = new Client();
//client.start();
client.processStream("127.0.0.1");
}
private java.util.Hashtable processStream ( String ip ) {
java.io.InputStream in = null;
try {
java.net.Socket socket = new java.net.Socket ( ip, Server.PORT );
java.io.OutputStream out = socket.getOutputStream();
out.write("command".getBytes());
out.flush();
//out.close();
in = socket.getInputStream();
} catch ( Exception e1 ) {
e1.printStackTrace ();
return null;
}
java.util.Hashtable ret = new java.util.Hashtable();
try {
org.jdom.input.SAXBuilder sb = new org.jdom.input.SAXBuilder ();
org.jdom.Document doc = sb.build ( in );
org.jdom.Element root = doc.getRootElement ();
Element element = root.getChild("cpu");
String content = element.getContent ();
//System.out.println ( content );
ret.put ( "CPU", content.trim () );
Element element1 = root.getChild("disk");
String content1 = element.getContent ();
//System.out.println ( content1 );
ret.put ( "DISK", content1.trim () );
} catch ( Exception e1 ) {
e1.printStackTrace ();
}
return ret;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -