|
|
|
@ -91,11 +91,13 @@ public class NiceCiApiService {
|
|
|
|
|
|
|
|
|
|
try (Socket socket = new Socket(HOST, PORT); // 서버에 연결
|
|
|
|
|
BufferedWriter out = new BufferedWriter(
|
|
|
|
|
new OutputStreamWriter(socket.getOutputStream(), Charset.forName("EUC-KR")));
|
|
|
|
|
new OutputStreamWriter(socket.getOutputStream(), Charset.forName("EUC-KR")));){
|
|
|
|
|
//new OutputStreamWriter(socket.getOutputStream()));
|
|
|
|
|
BufferedReader in = new BufferedReader(
|
|
|
|
|
new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")))) {
|
|
|
|
|
|
|
|
|
|
//BufferedReader in = new BufferedReader(
|
|
|
|
|
// new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")))) {
|
|
|
|
|
//InputStreamReader in = new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR")){
|
|
|
|
|
try {
|
|
|
|
|
InputStreamReader in = new InputStreamReader(socket.getInputStream(), Charset.forName("EUC-KR"));
|
|
|
|
|
socket.setSoTimeout(TIMEOUT); // 읽기 타임아웃 설정
|
|
|
|
|
|
|
|
|
|
out.write(binTxt);
|
|
|
|
@ -105,15 +107,27 @@ public class NiceCiApiService {
|
|
|
|
|
out.newLine();
|
|
|
|
|
out.flush();
|
|
|
|
|
|
|
|
|
|
String message;
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
|
while((message = in.readLine()) != null) {
|
|
|
|
|
sb.append(message);
|
|
|
|
|
};
|
|
|
|
|
//String message;
|
|
|
|
|
//while ((message = in.readLine()) != null) {
|
|
|
|
|
// sb.append(message);
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
char[] chars = new char[4096];
|
|
|
|
|
//in.read(chars);
|
|
|
|
|
|
|
|
|
|
while((in.read(chars) != -1)) {
|
|
|
|
|
sb.append(new String(chars));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtnMsg = sb.toString();
|
|
|
|
|
System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<====================================");
|
|
|
|
|
System.out.println(rtnMsg);
|
|
|
|
|
System.out.println("=============>>>서버 응답(EUC-KR로 읽어온 값)<<<====================================");
|
|
|
|
|
in.close();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
} catch (SocketTimeoutException e) {
|
|
|
|
|
// 타임아웃 발생 시 처리
|
|
|
|
|
log.error("NICE CI Socket 서버 응답 시간 초과: " + e.getMessage());
|
|
|
|
|