본문 바로가기

old

setConnectTimeout, setReadTimeout

각각 10초씩을 해놓았더니 운영 서버 반영 시 timeout 에러가 뜨며 undefined 오류를 리턴한다.

단, 보낸 데이터는 저장된다. readTimeout 문제라고 판단, readTimeout 시간을 늘려주었다.

 

HttpURLConnection connection = (HttpURLConnection) new URL(targetUrl).openConnection();
connection.setDoOutput(true);
connection.setConnectTimeout(10000);	// 10초
connection.setReadTimeout(30000);	// 30초
connection.setRequestMethod("POST");

 

  • connection timeout: TCP 연결을 생성할 때 시간 설정 문제 (syn, ack를 주고받을 때..)
  • read timeout: 연결된 데이터를 주고받을 때 시간 설정 문제 (url을 보내고 200 ok를 받을 때..)