[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jfriends] ¥¢¥×¥ì¥Ã¥È¤«¤é¤Î£Ã£Ç£Éµ¯Æ°¤Ë¤Ä¤¤¤Æ



¤³¤ó¡û¡û¤Ï¡¢²¡»³¤È¿½¤·¤Þ¤¹¡£

º£¡¢¥¢¥×¥ì¥Ã¥È¤«¤é£Ã¸À¸ì¤ÇºîÀ®¤·¤¿£Ã£Ç£É¤òµ¯Æ°¤·¤Æ²Ã¹©¤·¤¿¥Ç¡¼¥¿¤ò
ɽ¼¨¤µ¤»¤è¤¦¤È¤·¤Æ¤¤¤Þ¤¹¡£

£Ã£Ç£É¤Îµ¯Æ°¤Ï³Îǧ¤Ç¤­¤¿¤Î¤Ç¤¹¤¬¡¢Ìá¤Ã¤Æ¤­¤¿Ãͤò¼è¤ë»ö¤¬½ÐÍè¤Þ¤»¤ó¡£

---¡¡°Ê²¼¡¢ºîÀ®¤·¤¿¥½¡¼¥¹¤Ç¤¹¡£¡¡---

  void buttonControl1_mouseClicked(MouseEvent e) {
    String WRITE_CGI = "http://192.168.2.111/cgi/test.exe";
    String data_string = "a=1&b=2";¡¡¡ã¡Ý¥Ñ¥é¥á¡¼¥¿¤Ç¤¹¡£
    getAppletContext().showStatus("Sending data");
    try {
      String cgi = WRITE_CGI;
      URL u = new URL(cgi);
      URLConnection uc = u.openConnection();
      uc.setDoOutput(true);
      PrintStream ps = new PrintStream(uc.getOutputStream());
      ps.print(data_string);
      ps.close();
      fieldControl1.setText("Sending data...");

      DataInputStream dis = new DataInputStream(uc.getInputStream());
      fieldControl1.setText("Get data...");
      String ins = dis.readLine();
      fieldControl2.setText(ins);
    } catch (UnknownHostException eHost) {
      fieldControl2.setText("Host error!");
    } catch (MalformedURLException eM) {
      fieldControl2.setText("second error!");
    } catch (IOException ex) {
      fieldControl2.setText("final error!");
    }
  }
}

---¡¡°Ê¾å¡¢¤½¡¼¤¹¤Ç¤·¤¿¡£¡¡---

DataInputStream dis = new DataInputStream(uc.getInputStream());¤ÎÉôʬ¤Ç
IOException¤ËÊá¤Þ¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£

£Ã£Ç£É¤Ï¡¢É¸½àÆþ½ÐÎϤò»È¤Ã¤Æ¤¤¤Þ¤¹¡£

£Ã£Ç£É¤«¤éÁ÷¤é¤ì¤¿¥Ç¡¼¥¿¤ò¤É¤ÎÍͤ˼õ¤±¼è¤Ã¤¿¤é¤è¤í¤·¤¤¤Î¤Ç¤·¤ç¤¦¤«¡£

***********************************************************
¡¡¡¡²¡»³¡¡Î´¡§oshi@xxxxxxxxxx

¡Ê³ô¡Ë¥Õ¥©¡¼¥«¥¹¥·¥¹¥Æ¥à¥º¡¡Âè3»ö¶ÈÉô¡¡tel03-5420-2470