luffy
luffy

Reputation: 127

Difference between functioning of net.Listen and http.ListenAndServe

I'm new to Go and Networking. I know both net.Listen and http.ListenAndServe creates a server. But what is the difference between their functionality?

Upvotes: 6

Views: 2820

Answers (1)

Ullaakut
Ullaakut

Reputation: 3734

Basically, as the documentation says for net.Listen: The network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".

While http.ListenAndServe creates an HTTP server.

Upvotes: 6

Related Questions