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

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

虛擬機提示線程異常,錯誤的Client

虛擬機提示線程異常,錯誤的Client

qq_丘比特_0 2016-05-24 00:08:19
import ?java.io.*;import ? java.net.*;class ?PicClient{ public ? static ?void ?main(String[] ? args)throws ?Exception { Socket ?s=new ?Socket("192.168.1.2",10007); FileInputStream ?fis ?=new ? FileInputStream("C:\\1.bmp"); OutputStream ?out=s.getOutputStream(); byte[] ? buf=new ?byte[1024]; int ?len=0; while((len=fis.read(buf))!=-1) { out.write(buf,0,len); } s.shutdownOutput();InputStream ?in=s.getInputStream();byte[] ?bufIn=new ?byte[1024];int ?num=in.read(bufIn);System.out.println(new ?String(bufIn,0,num));fis.close();s.close(); }}class ?PicServer{ public ?static ?void ?main(String[] ?args)throws ? Exception { ServerSocket ?ss=new ?ServerSocket(10007); Socket ?s=ss.accept(); InputStream ? in=s.getInputStream(); FileOutputStream ?fos=new ? FileOutputStream("server.bmp"); byte[] ? buf=new ?byte[1024]; int ?len ?=0; while((len=in.read(buf))!=-1) { fos.write(buf,0,len); } OutputStream ?out=s.getOutputStream(); out.write("上傳成功".getBytes()); fos.close(); s.close(); ss.close(); }}
查看完整描述

目前暫無任何回答

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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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