用的是下面的方法,用Edge是可以收到的,谷歌瀏覽器不行
沒有報錯,就是接收不到,是可以連接上
public void receive(){
try {
Socket client = serverSocket.accept();
System.out.println("一個客戶端建立了連接");
// 獲取協議
InputStream is = client.getInputStream();
byte[] datas = new byte[1024*1024];
int len = is.read(datas);
System.out.println(len);
String requestInfo = new String(datas, 0, len);
System.out.println(requestInfo);
} catch (IOException e) {
System.out.println("客戶端錯誤");
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/78924.html
標籤:Java相關
上一篇:出現這種錯誤是怎么一回事?
下一篇:editor.md 使用教程
