views:

292

answers:

6

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.

+3  A: 

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.

David Schmitt
A: 

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.

RHicke
+1  A: 

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

Rubens Farias
+1  A: 

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.

tommieb75
A: 

Hi

This post http://stackoverflow.com/questions/1196623/tcp-vs-http-benchmark should be handy.

cheers

Andriyev
A: 

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?

TheNoob
Named Pipes are more for the local machine itself using no networking benefits. It is for sharing data, a simple example, a server registers a pipe and open it for reading, a client on the same machine opens the specified pipe and sends data to it, the server than receives the data. That is called Inter Process Communication and for separate processes on the same machine to communicate with one another.
tommieb75
Aren't named pipes also used across the network? If so, how does it differ from Tcp? Forgive me for being repetitive.
TheNoob
Please see here for a more detailed insight into named pipes http://en.wikipedia.org/wiki/Named_Pipes, but under Unix/Linux, it can be used across the network via usage of NFS/pipes, but under Windows...the system of pipes is different. Hope that helps and answers your question.
tommieb75