shjung преди 3 години
родител
ревизия
cfa8dea2ab

+ 1 - 1
src/main/java/com/its/op/controller/its/vds/VdsControlController.java

@@ -27,7 +27,7 @@ public class VdsControlController {
 
     @ApiOperation(value = "VDS 제어기 리셋", response = VdsControlDto.VdsControlRes.class)
     @PostMapping(value = "/reset/{id}", produces = {"application/json; charset=utf8"})
-    public VdsControlDto.VdsControlRes controlPtz(
+    public VdsControlDto.VdsControlRes controlReset(
             @ApiParam(name = "id", value = "제어기번호", example = "1", required = true)
             @PathVariable("id") String id,
             @ApiParam(name = "req", value = "제어기번호", example = "1", required = true)

+ 18 - 1
src/main/java/com/its/op/service/its/vds/VdsControlService.java

@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.InetSocketAddress;
 import java.net.Socket;
@@ -209,7 +210,7 @@ log.error("{}", saveFileName);
         String ipAddress = this.vdsServerConfig.getIpAddress();
         int port = this.vdsServerConfig.getPort();
         int connectTimeout = 3000; // milli-seconds
-        int readTimeout = 5000; // milli-seconds
+        int readTimeout = cmdType == 0 ? 2000 : 5000; // milli-seconds
         SocketAddress socketAddress = new InetSocketAddress(ipAddress, port);
         Socket socket = null;
         if (cmdType == 1) {
@@ -232,6 +233,22 @@ log.error("{}", saveFileName);
             os.write(data);
             os.flush();
 
+            // 24 04 01 01 00 70 00 00 00 0d
+            // OpCode: 5
+            // Length: 6 7 8 9
+            InputStream recvStream = socket.getInputStream();
+            boolean loop = true;
+            byte[] buffer = new byte[2048];
+            while (loop) {
+                try {
+                    int recvLen = recvStream.read(buffer, 0, buffer.length);
+                    log.error("recv: {} Bytes.", recvLen);
+                } catch (IOException e) {
+                    log.error("VdsControlService: requestVdsCommand, recvStream.read IOException, {}", e.getMessage());
+                    result.setResult(4, "VDS 서버와 통신로 부터 결과 수신 시간초과가 발생하였습니다.");
+                    loop = false;
+                }
+            }
         }
         catch (IOException e) {
             log.error("X. {}, {}, {}", ipAddress, port, e.getMessage());