看板 java 關於我們 聯絡資訊
請問一下,如果是Server端 用Socket接收到的DataInputStream,要如何丟到String裡 我有查網路資料是用 dis.readLine,但Eclipse說已經Deprecated了 也有查到是用 byte input[]=new byte[dis.available()]; dis.readFully(input); 但我試的結果是失敗,input結果是空的 我的書上的範例是用dis.readByte() 但一個字一個字讀好像沒有必要(書上的Client是用Telnet登入連Server) Client端我是用以下方式丟字串 OutputStream os=socket.getOutputStream(); os.write(new String(namestr).getBytes()); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 36.231.136.75
Expsun:http://tinyurl.com/cq4s74v 05/07 06:37
llzzyy01:成功了,謝謝樓上大大 05/08 00:00