看板 java 關於我們 聯絡資訊
m.... 問題描述如下: Server的片段code: outputToClient.writeBytes("aaa"); Client的片段code: n = fromServer.read(buf); s = new String(buf , 0 , n) ; System.out.println("Server 傳回"+ s); 然後當我印出print server傳來的東西時 應該要印aaa 可是卻只印了一個 a 我看了api 也爬了些文 不知道是哪裡搞錯了 大大幫幫忙八.................. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.165.218.155
howard0215:天哪 哪位好人說一下阿 05/03 01:12
※ 編輯: howard0215 來自: 118.165.218.155 (05/03 01:16)
Sangox:server送出之後flush()試試, 或者是buf只設了1? 05/03 01:40
howard0215:yeah buf沒清掉 ..... 浪費我好多時間 >< 05/03 02:08