refactor: rename examples/ directory to lib/ and update all path references
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
entity "grpccanary/lib/grpcentity"
|
||||
"grpccanary/lib/jsonexample"
|
||||
"time"
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
// 2. 서버 포트가 바인딩되어 통신 대기 상태에 들어갈 시간을 일시적으로 보장
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
// 3. gRPC 클라이언트를 구동하여 원격 프로시저(RPC) 기동 시뮬레이션 집행
|
||||
entity.ClientRun(port)
|
||||
}
|
||||
Reference in New Issue
Block a user