亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用http協議建立接連問題,下面是客服端的代碼。IP沒有錯

用http協議建立接連問題,下面是客服端的代碼。IP沒有錯

慕村5072873 2018-02-05 17:39:58
public void printerInfo() { ? ?System.out.println("愛的發發達發達的說"); ?URL url = null; ? ?String uslStr = "http://192.168.0.106:8080/manage/typer/save.shtml"; ? ?try { ? ? ? ?url = new URL(uslStr); ? ? ? ?try { ? ? ? ? ? ?PrecisionPrint precisionPrint = new PrecisionPrint(); ? ? ? ? ? ?JSONObject jsonObject = precisionPrint.getPrintMSg(); ? ? ? ? ? ?URLConnection urlConnection = url.openConnection(); ? ? ? ? ? ?urlConnection.setRequestProperty("content-type", "application/x-www-form-urlencoded"); ? ? ? ? ? ?urlConnection.setDoOutput(true); ? ? ? ? ? ?urlConnection.setDoInput(true); ? ? ? ? ? ?OutputStream out = urlConnection.getOutputStream(); ? ? ? ? ? ?out.write(jsonObject.toString().getBytes("utf-8")); ? ? ? ? ? ?out.flush(); ? ? ? ? ? ?out.close(); ? ? ? ? ? ?// 從服務器讀取響應 ? ? ? ? ? // InputStream inputStream = urlConnection.getInputStream(); ? ? ? ? ? ?//String body = IOUtils.toString(inputStream, "utf-8"); ? ? ? ? ? ?//System.out.println("返回的值是:" + body); ? ? ? ?} catch (Exception e) { ? ? ? ? ? ?e.printStackTrace(); ? ? ? ?} ? ?} catch (MalformedURLException e) { ? ? ? ?e.printStackTrace(); ? ?}}
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 971 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號