Skip to content

Commit

Permalink
Handle concurrent connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Anwar Ziani committed Oct 20, 2023
1 parent a46716e commit 0741884
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ func main() {
}
log.Println("Listening on " + port)

// listen to incoming connections
conn, err := l.Accept()
if err != nil {
log.Fatalf("Error accepting connection: %s", err.Error())
}
for {
// listen to incoming connections
conn, err := l.Accept()
if err != nil {
log.Fatalf("Error accepting connection: %s", err.Error())
}

handleConn(conn)
go handleConn(conn)
}
}

func readRequest(conn net.Conn) (*Request, error) {
Expand Down

0 comments on commit 0741884

Please sign in to comment.