Skip to content

Commit

Permalink
Check the error of net.Listen
Browse files Browse the repository at this point in the history
  • Loading branch information
M. Mert Yildiran committed Oct 25, 2021
1 parent a75cd70 commit 4edace7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

# Build
build/
./basenine
basenine
7 changes: 3 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,11 @@ func main() {
os.Exit(0)
}

log.Println("Starting server...")

// Start listenning to given address and port.
src := *addr + ":" + strconv.Itoa(*port)
listener, _ := net.Listen("tcp", src)
log.Printf("Listening on %s.\n", src)
listener, err := net.Listen("tcp", src)
check(err)
log.Printf("Listening on %s\n", src)

defer listener.Close()

Expand Down

0 comments on commit 4edace7

Please sign in to comment.