From 0f78b519452a54568e5d07228274d502eb3bb353 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 12 Nov 2021 00:55:15 +1300 Subject: [PATCH] Open socket before defer close --- src/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.go b/src/main.go index f454236..0b489ed 100644 --- a/src/main.go +++ b/src/main.go @@ -66,6 +66,8 @@ func main() { panic(err) } + + ln, _ := net.Listen("tcp", ":8081") //cleanup defer func() { @@ -85,7 +87,7 @@ func main() { }() //accepts command from cmd.go and sends them to the server - ln, _ := net.Listen("tcp", ":8081") + go func() { //accept connections from clients for {