doupo2157 2013-02-17 19:17
浏览 148
已采纳

Golang中net / http和net / http / fcgi之间的区别

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 the net/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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料