What's the difference? If I use net/http/fcgi package, every request will be executed in new goroutine. It seems to be the same for net/http ListenAndServe...isn't it? What advantages and disadvantages?
1条回答 默认 最新
- dongyupan4850 2013-02-17 19:25关注
The
net/http/fcgi
allows you to listen via the FastCGI protocol for new connections whereas thenet/http
ListenAndServe is there for listening for incoming http connections. With a FastCGI listener you need an http server sitting in front of the Go process that is proxying incoming connections and sending requests via FastCGI to you Go process.FastCGi can be useful if you have multiple services that you need to expose on the same port. You can run something like Apache or Nginx as the front end and expose certain urls to your Go process via FastCGI.
If this is not your case and you just want to run a Go web server on a port, stick with
net/http
.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报