다음 코드는 스레드의 실행() 세그먼트에서 발생설명서에서 왜 BluetoothServerSocket.accept()가 스레드를 차단하는 경우 while 루프에서 호출 되었습니까? 안드로이드 문서에서
BluetoothSocket socket = null;
// Keep listening until exception occurs or a socket is returned
while (true) {
try {
socket = mmServerSocket.accept();
} catch (IOException e) {
break;
}
// If a connection was accepted
if (socket != null) {
// Do work to manage the connection (in a separate thread)
manageConnectedSocket(socket);
mmServerSocket.close();
break;
}
}
그러나, 스레드() 메소드 블록에 동의합니다. 따라서 while() 루프가 필요한 이유를 이해할 수 없습니다. 특히 모든 가능한 상황에서 while 루프가 첫 번째 실행에서 중단되기 때문입니다.
아이디어가 있으십니까?
위시 나는 대답으로 이것을 받아 들일 수 있었다. 감사합니다. – Userrrrrrrrr
글쎄 이제 할 수 있습니다 : - | – EJP
이미 있음, 고마워요.) – Userrrrrrrrr