From 4697f7e069aade21c65606529132be418e2d4300 Mon Sep 17 00:00:00 2001 From: Godopu Date: Fri, 17 Jul 2026 17:21:41 +0900 Subject: [PATCH] feat: complete grpcSample() orchestrator in main.go --- examples/main.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/main.go b/examples/main.go index b14ed44..a4fcdbb 100644 --- a/examples/main.go +++ b/examples/main.go @@ -10,15 +10,22 @@ import ( var port = ":8080" func main() { + // 1단계: JSON 파싱 예제 실행 jsonexample.JsonParsingExample() + + // 3단계: gRPC 통신 예제 실행 (필요 시 주석 제거하여 활성화 가능) + // grpcSample() } func grpcSample() { + fmt.Println("--- starting gRPC IoT Simulation ---") + + // 1. gRPC 서버를 백그라운드 고루틴으로 구동 go entity.ServerRun(port) - // Just to be sure that the server is running - time.Sleep(1 * time.Second) + // 2. 서버 포트가 바인딩되어 통신 대기 상태에 들어갈 시간을 일시적으로 보장 + time.Sleep(100 * time.Millisecond) - fmt.Println("Client:") - entity.ClientRun("localhost" + port) + // 3. gRPC 클라이언트를 구동하여 원격 프로시저(RPC) 기동 시뮬레이션 집행 + entity.ClientRun(port) }