开发者

.NET Remoting - HttpChannel vs TcpChannel

开发者 https://www.devze.com 2022-12-17 15:46 出处:网络
I\'m new to .NET Remoting and not very familiar with the different communication channels which can be used.I know there is HttpChannel and TcpChannel out o开发者_开发问答f the box.I understand that o

I'm new to .NET Remoting and not very familiar with the different communication channels which can be used. I know there is HttpChannel and TcpChannel out o开发者_开发问答f the box. I understand that one is Http while the other is Tcp, but I don't understand why Tcp is faster.


The HTTP channel has to create a huge (relatively speaking) header and parse complex responses. The TCP channel on the uses an efficient binary protocol with much less overhead per request.


The reason Tcp is faster, is that it uses binary as a means of data transmission across the wire, with TcpChannel, you can use any port number above 1024 (the first 1024 ports are reserved). Whereas with HttpChannel, it is using port 80, the standard port that is shared with your web browser, the HttpChannel is used if you want to make it flexible with other services. Furthermore, data passed through the HttpChannel are encoded in text, which makes it slower, for an example, if you were to retrieve an image, that image would have to be encoded first into Base64 data format and transferred across.

Generally, if you want speed, go for TcpChannel, if you want flexibility, go for HttpChannel.

Hope this helps, Best regards, Tom.


TCP is slightly faster than HTTP; HTTP defaults to using the slower Soap formatter and TCP defaults to using the faster Binary formatter; HTTP supports the faster Binary formatter - you just need to select it

Source: Factoids about HTTP and TCP remoting channels


Tcp is faster because it is a faster protocol.

Tcp is a lower level protocol that can establish a secure reliable connection. Http is easier to use as you can send it to a web server from your browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消