본문 바로가기

프로그래밍 일반/안드로이드 심화

“Software caused connection abort: socket write error”

이 에러는 서버쪽에서 close하는 것을 제대로 안 해서 생긴 문제이다.

 

참고자료

stackoverflow.com/questions/2126607/official-reasons-for-software-caused-connection-abort-socket-write-error

https://ndb796.tistory.com/55?category=986634

 

class USER {
public void run() {
            try {
                while (true) {
                //데이터 듣기중
                String message_from_client = data_input_stream.readUTF();
                }
            } catch (Exception e) {
                System.out.println(
                        "[메시지 수신 오류] " + socket.getRemoteSocketAddress() + " : " + Thread.currentThread().getName());
//ArrayList에 추가한 유저를 삭제한다.
AdvancedChat.user_list.remove(UserClass.this);
                e.printStackTrace();
            }
        }
}