*
*/
extends Thread{
CmwapForm cf;
public CmwapThread(CmwapForm cf){
this.cf = cf;
}
public void run(){
try{
//
cf.displayInfo("
//
SocketConnection sc = (SocketConnection)Connector.open("socket://10.0.0.172:80");
//
cf.displayInfo("
//
OutputStream os = sc.openOutputStream();
String requestLine = "get http://www.freewebs.com/cqucyf/a.htm http/1.0\r\n";
String header = "accept:*/*\r\n\r\n";
os.write(requestLine.getBytes());
os.write(header.getBytes());
os.flush();
//
cf.displayInfo("
//
InputStream is = sc.openInputStream();
byte[] data = new byte[10240];
int num = is.read(data);
//
cf.displayInfo("
//
cf.doStr(data,num);
sc.close();
}catch(Exception e){
//e.printStackTrace();
cf.doError(e.toString());
}
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=674736