Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF NetTCPBinding vs HttpBinding difference in data sent on wire

Say I have a service exposing two end points, 1st is a NetTCPBinding the second is any flavour of HttpBinding. They both implement exactly the same service contract.

What is the difference in what is sent on the wire?

  • Using netTcp is my message still serialised to XML ? Or some binary representation of my objects?
  • In terms of what receives the messages what is the difference? Will the http endpoint only understand http commands (get/post etc) where as the nettcp end point understands something different?
  • Why is nettcp more efficient (in this case I dont need interoperability) than http - where is the overhead?

I think that in all cases, before the message is put onto the wire it will be converted to binary so, also http sits on top of tcp in networking terms - so somewhere extra is needed for http communications.

Appreciate the question is a bit vague but hopefully someone will know what I am trying to ask :)

like image 662
Remotec Avatar asked Mar 31 '11 12:03

Remotec


People also ask

What is NetTcpBinding in WCF?

Remarks. This binding generates a run-time communication stack by default, which uses transport security, TCP for message delivery, and a binary message encoding. This binding is an appropriate Windows Communication Foundation (WCF) system-provided choice for communicating over an Intranet.

Which of the following WCF binding is used for cross machine communication on the Internet?

NetMsmqBinding. It is used for queue communication. It means that this binding gives us secure and reliable queued communication for the cross machine environment. Uses MSMQ as transport protocol and provides reliable, robust and distributed application.

Which of the following .NET bindings are suitable for cross machine communication?

A queued binding that is suitable for cross-machine communication between WCF applications. A binding that enables secure, multiple machine communication. A binding that is suitable for cross-machine communication between a WCF application and existing Message Queuing applications.

Is Net TCP encrypted?

“NetTcpBinding is secure by default. Specifically, callers must provide Windows credentials for authentication and all message packets are signed and encrypted over TCP protocol.” To control the security mode used for a particular binding, set the mode property for the binding's <security> section.


1 Answers

In WCF a particular binding does not necessarily imply a particular encoding. Various bindings can be configured to use various encodings. Net.TCP uses a binary encoding by default (MTOM I think), and HTTP uses a text/xml encoding by default.

With net.tcp your messages go sender -> net.tcp -> receiver. With HTTP they go from sender -> http -> tcp -> http -> receiver. There's an extra layer. The advantage of tcp is both of those: Both the extra layer and the default encoding.

HTTP with a binary encoding approaches net.tcp performance.

EDIT: Actually I think there may also be other optimizations in Net.TCP. It's a WCF-WCF communication scenario, so MS has control of both ends.

like image 138
JohnC Avatar answered Nov 30 '22 19:11

JohnC