Rasshme
Rasshme

Reputation: 1641

In WCF , when should a TCP binding be used?

In WCF , when should a TCP binding be used? I know the scenario when web browser is the WCF client. In that case HTTP is used. But what are the scenarios for TCP ?

Thanks for ur replies.

Upvotes: 1

Views: 324

Answers (2)

marc_s
marc_s

Reputation: 754468

Basically, whenever you can! NetTcp is much more efficient than http - it's encoding binary which saves a lot of bandwidth, and it has other properties which make it really really fast.

Trouble is: the other end of the communication (you always have a server and a client) also must understand this protocol. It's .NET specific, so any non-.NET client will not able to use it.

Also, NetTcp doesn't typically use port 80, so if you want to use it over the internet, you'll have to open up ports on firewalls to let the traffic go through - not always easy and possible.

But if you have an intranet scenario - e.g. your company's LAN environment - and you have .NET clients calling your WCF service, there's no reason at all not to use NetTcp !

Upvotes: 4

Anders Abel
Anders Abel

Reputation: 69260

The NetTcpBinding is the most efficient in terms of overhead and bandwidth utilization. As soon as you have a native .NET client you should use it.

Upvotes: 0

Related Questions