안녕하세요! 오늘 하루도 좋은일만 가득하세요!
질문들어가겠습니다!
NIO SSL소켓통신으로 python과 통신하는 부분을 개발하던중
궁금한점이 여러개 생겨서 이렇게 질문을 해보게 되었습니다.
readSelector = Selector.open();
socketChannel.register(readSelector, SelectionKey.OP_READ);
이렇게 셀랙터를 설정하고
while (true) {
try {
Log.e("", "start while1 진입했는가");
Log.e("", readSelector + " readSelector");
Log.e("", readSelector.isOpen() + " isOpen");
Log.e("", readSelector.keys() + " keys");
Log.e("", readSelector.selectedKeys() + " selectedKeys");
readSelector.select();
이런식으로 돌려보는데!!
맨아랫줄 readSelector.select();에서
무한 루프에 빠졌는지 저 문장 다음으로 넘어가지를 못합니다ㅠㅠ
그리고 log로 찍은 부분들을 쭉 보면
[ 09-06 14:05:19.298 7452: 7873 E/ ] start while1 진입했는가
[ 09-06 14:05:19.298 7452: 7873 E/ ] java.nio.SelectorImpl@65644f7 readSelector
[ 09-06 14:05:19.298 7452: 7873 E/ ] true isOpen
[ 09-06 14:05:19.303 7452: 7873 E/ ] [] keys
[ 09-06 14:05:19.303 7452: 7873 E/ ] java.nio.SelectorImpl$UnaddableSet@0 selectedKeys
이렇게 찍힙니다.. 여기서 제가 넣은 값을 제외하면
[ 09-06 14:05:19.298 7452: 7873 E/ ]
[ 09-06 14:05:19.298 7452: 7873 E/ ] java.nio.SelectorImpl@65644f7
[ 09-06 14:05:19.298 7452: 7873 E/ ] true
[ 09-06 14:05:19.303 7452: 7873 E/ ] []
[ 09-06 14:05:19.303 7452: 7873 E/ ] java.nio.SelectorImpl$UnaddableSet@0
이렇게 인데 keys값이 []이거인 이유랑 selectedKeys값이 unaddableSet@0 인 이유가
중요한 단서가 될꺼같아서 올려보았습니다..
질문을 정리해보면
readSelector.select();에서 빠져나오지 못하는 이유와
keys와 selectedKeys 값이 없다고 나오는지
알고싶습니다!!