亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Java 判斷socket的連接狀態(tài)
伊謝爾倫
伊謝爾倫 2017-04-17 17:37:56
0
1
714

1.android 設(shè)備在未有設(shè)備連接的時(shí)候,怎么判斷socket是未連接,如果使用API提供的isConnected()的方法會(huì)報(bào)一個(gè)空指針

2.當(dāng)socket連接的設(shè)備突然斷開怎么實(shí)時(shí)獲取socket的狀態(tài)

3在進(jìn)行socket通信的時(shí)候會(huì)出現(xiàn)可以發(fā)送數(shù)據(jù),卻收不到數(shù)據(jù),如果處理

伊謝爾倫
伊謝爾倫

小伙看你根骨奇佳,潛力無限,來學(xué)PHP伐。

reply all(1)
巴扎黑
  1. Is the server enabled on your device? , if yes, then ServerSocket.accept()方法是阻塞的,你的判斷代碼不要寫在這個(gè)方法成功前就創(chuàng)建好的其他線程內(nèi),要與ServerSocket.accept()在同一線程或者在 ServerSocket.accept() 執(zhí)行后新開的線程內(nèi),以保證判斷方法也會(huì)被阻塞影響。 ——另外判斷連接狀態(tài)用Socket.isClosed().

  2. There is no way to achieve complete real-time. You can look at the information on the heartbeat mechanism. Generally, this method of continuously sending simple data is used to determine whether the remote end is online.

  3. Same as the heartbeat mechanism above, you can ask the receiving end to return a result mark to you after the data is sent successfully.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template