// Listen starts listening for incoming connections from the client
Listen starts listening for incoming connections from the client
// Listen starts listening for incoming connections from the client
func (server *Server) Listen(address string) error {
	listener, err := net.Listen("tcp", address)
	if err != nil {
		return fmt.Errorf("error while trying to listen on given address: %s", err)
	}
	defer listener.Close()
	for {
		conn, err := listener.Accept()
		if err != nil {
			return fmt.Errorf("error while trying to accept incoming connection: %s", err)
		}
		go server.HandleConnection(&Connection{Conn: conn})
	}
}
func ( server * Server ) Listen ( address string ) error { listener , err := net . Listen ( " " , address ) if err != nil { return fmt . Errorf ( " " , err ) } defer listener . Close ( ) for { conn , err := listener . Accept ( ) if err != nil { return fmt . Errorf ( " " , err ) } go server . HandleConnection ( & Connection { Conn : conn } ) } }
Listen starts listening for incoming connections from the client
Listen starts listening for incoming connections from the client
// handle connection in a separate goroutine