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 of 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.
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.
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
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.
Hi
This post http://stackoverflow.com/questions/1196623/tcp-vs-http-benchmark should be handy.
cheers
Thanks for the great answers! My next question, what is the difference between named pipes and using the TcpChannel? Is it even an apples to apples comparison?