Difference between TcpBinding and HttpDualBinding for Callback in WCF


The Http bindings serialized messages into XML and send them via HTTP. HTTP is request response protocol, which is one way communication at a time. Caller sends requests to the server and server responds and sends response messages. Once the response is received connection gets closed whereas TCP is bidirectional protocol which enable socket to send and receive messages simultaneously. TcpBinding Offered by the NetTcpBinding class, TCP binding uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.

TcpBinding serialized data onto the wire in a binary-encoded-XML format which is considerably more efficient than XML and transports data via TCP which can, in some circumstances be more efficient than HTTP.

The downside of TCP is that you have to open holes in firewalls to allow TCP traffic through. The benefit of HTTP is that it uses TCP Port 80 which is generally left open in most firewalls.

If you want bi-directional full-duplex communications between caller and service, you can either

1) use a single TCP socket, but run the risk of a firewall in between blocking communications, or 2) use two HTTP connections – one from the client to the service, the other from the service to the client. This will be a little slower than a duplex TcpBinding, but far more likely to pass through most firewalls.

TcpBindings are not Interoperable, client and server machine should have .Net framework installed whereas HttpBindings (BasicHttpBinding,HttpDualBinding,WsHttpBinding) are interoperable because data transmits in XML format.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: