HTTP联网开发小例子[2]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

        String type = c.getType();
        System.out.println("type : " + type);
        DataInputStream dis = new DataInputStream(is);
        int length = dis.available();
        byte [] reponseBytes = new byte[length];
        dis.read(reponseBytes);
        System.out.println("Received . :" + new String(reponseBytes));

    } finally {
        if (is != null)
            is.close();
        if (os != null)
            os.close();
        if (c != null)
            c.close();
    }
}

}

 

 

import javax.microedition.midlet.*;

public class Main extends MIDlet {
  public Main() {
  }
  protected void pauseApp() {
    /**@todo Implement this javax.microedition.midlet.MIDlet abstract method*/
  }
  protected void startApp() throws javax.microedition.midlet.MIDletStateChangeException {
    /**@todo Implement this javax.microedition.midlet.MIDlet abstract method*/
     new Http("http://127.0.0.1:8080/examples/servlet/HttpGameServer");

  }
  protected void destroyApp(boolean parm1) throws javax.microedition.midlet.MIDletStateChangeException {
    /**@todo Implement this javax.microedition.midlet.MIDlet abstract method*/
  }

}

本文关键:HTTP联网开发小例子
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top