diff --git a/cmd/ui.go b/cmd/ui.go index d3988f6..1c5b7cc 100644 --- a/cmd/ui.go +++ b/cmd/ui.go @@ -35,7 +35,11 @@ func listener(g *gocui.Gui, conn net.Conn) { } for { reply := make([]byte, 2048) - conn.Read(reply) + _, err := conn.Read(reply) + if err != nil { + g.Close() + log.Fatalf("Server closed connection\n") + } fmt.Fprintln(chatbox, string(reply)) termbox.Interrupt()