Go实战--go中使用rpc(The way to go)

朴灿烈づ我的快乐病毒、 2022-06-14 04:40 335阅读 0赞

生命不止,继续 go go go !!!

今天聊聊golang中如何使用rpc,各位先稍安勿躁,我们先介绍一些基本的知识。

TCP和Http
这个stackoverlow上的回答,觉得很好,搬过来:

HTTP is a layer built ontop of the TCP layer to some what standardize data transmission. So naturally using TCP sockets will be less heavy than using HTTP. If performance is the only thing you care about then plain TCP is the best solution for you.

You may want to consider HTTP because of its ease of use and simplicity which ultimately reduces development time. If you are doing something that might be directly consumed by a browser (through an AJAX call) then you should use HTTP. For a non-modern browser to directly consume TCP connections without HTTP you would have to use Flash or Silverlight and this normally happens for rich content such as video and/or audio. However, many modern browsers now (as of 2013) support API’s to access network, audio, and video resources directly via JavaSc

发表评论

表情:
评论列表 (有 0 条评论,335人围观)

还没有评论,来说两句吧...

相关阅读