Skip to content

Commit 04029be

Browse files
committed
✨ add new flow
1 parent 4306254 commit 04029be

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func main() {
2222
conn, err := listener.Accept()
2323
if err != nil {
2424
ulog.ErrorContext(ctx, "failed to accept request", slog.Any("err", err))
25+
continue
2526
}
2627

2728
// Handle the connection
@@ -106,4 +107,6 @@ func main() {
106107
}
107108
}
108109
}
109-
```
110+
```
111+
112+
## 以上是 針對 golang 使用 socket 的範例

cmd/tcp-server/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ func main() {
2424
ulog.ErrorContext(ctx, "failed to listen", slog.Any("addr", listener.Addr().String()))
2525
os.Exit(1)
2626
}
27+
ulog.InfoContext(ctx, "server start", slog.String("port", config.AppConfig.Port))
2728
defer listener.Close()
2829

2930
for {
3031
// Accept an incoming connection
3132
conn, err := listener.Accept()
3233
if err != nil {
3334
ulog.ErrorContext(ctx, "failed to accept request", slog.Any("err", err))
35+
continue
3436
}
3537

3638
// Handle the connection

0 commit comments

Comments
 (0)