func (s *Server) ListenAndServe(addr string) error {
	ln, err := net.Listen("tcp4", addr)
	if err != nil {
		return err
	}
	if s.TCPKeepalive {
		if tcpln, ok := ln.(*net.TCPListener); ok {
			return s.Serve(tcpKeepaliveListener{
				TCPListener:     tcpln,
				keepalivePeriod: s.TCPKeepalivePeriod,
			})
		}
	}
	return s.Serve(ln)
}
func (s *Server) ListenAndServe(addr string) error {
	ln, err := net.Listen("tcp4", addr)
	if err != nil {
		return err
	}
	if s.TCPKeepalive {
		if tcpln, ok := ln.(*net.TCPListener); ok {
			return s.Serve(tcpKeepaliveListener{
				TCPListener:     tcpln,
				keepalivePeriod: s.TCPKeepalivePeriod,
			})
		}
	}
	return s.Serve(ln)
}
func ( s * Server ) ListenAndServe ( addr string ) error { ln , err := net . Listen ( " " , addr ) if err != nil { return err } if s . TCPKeepalive { if tcpln , ok := ln . ( * net . TCPListener ) ; ok { return s . Serve ( tcpKeepaliveListener { TCPListener : tcpln , keepalivePeriod : s . TCPKeepalivePeriod , } ) } } return s . Serve ( ln ) }
// ListenAndServe serves HTTP requests from the given TCP4 addr.
//
// Pass custom listener to Serve if you need listening on non-TCP4 media
// such as IPv6.
//
// Accepted connections are configured to enable TCP keep-alives.
ListenAndServe serves HTTP requests from the given TCP4 addr . Pass custom listener to Serve if you need listening on non - TCP4 media such as IPv6 . Accepted connections are configured to enable TCP keep - alives .