Hi all, I need help regarding WCF.... I have read that in we can WCF we can do communication in protocol independent manner i.e. we can use TCP instead of HTTP for web services...
Before reading WCF my concept was TCP is used for inter network communication and HTTP is used for accessing web sites, web services over the internet and intranet....
can some body tell me in which situation we need to use TCP rather then HTTP and what benefits we can achieve via this change??
any help in this regards would be heighly appreciated
thanks in advance.
Loading
Praneeth KumarPosted Jun 13, 2011, 4:15 AM
When to Use HTTP Transport
HTTP is a request/response protocol between clients and servers. The most common application consists of Web-browser clients that communicate with a Web server. The client sends a request to a server, which listens for client request messages. When the server receives a request, it returns a response, which contains the status of the request. If successful, optional data, such as a Web page, an error message, or other information is returned. For more information about the HTTP protocol, see HTTP - Hypertext Transfer Protocol.
The HTTP protocol is not connection-based—once the response is sent, no state is maintained. To handle multiple-page transactions, the application must persist any necessary state.
In WCF, the HTTP transport binding is optimized for interoperability with legacy non-WCF systems. If all communicating parties are using WCF, the TCP-based or named pipes-based bindings are faster. For more information, see NetTcpBinding and NetNamedPipeBinding.
When to Use the TCP Transport
TCP is a connection-based, stream-oriented delivery service with end-to-end error detection and correction. Connection-based means that a communication session between hosts is established before exchanging data. A host is any device on a TCP/IP network identified by a logical IP address.
TCP provides reliable data delivery and ease of use. Specifically, TCP notifies the sender of packet delivery, guarantees that packets are delivered in the same order in which they are sent, retransmits lost packets, and ensures that data packets are not duplicated. Note that this reliable delivery applies between two TCP/IP nodes, and is not the same thing as WS-ReliableMessaging, which applies between endpoints, no matter how many intermediate nodes they may include.
The WCF TCP transport is optimized for the scenario where both ends of the communication are using WCF. This binding is the fastest WCF binding for scenarios that involve communicating between different machines. The message exchanges use the BinaryMessageEncodingBindingElement for optimized message transfer. TCP provides duplex communication and so can be used to implement duplex contracts, even if the client is behind network address translation (NAT).
To add more TCP is used for some applications like Chat wherein there has to be a reliable communication with the server and client.
Praneeth KumarPosted Jun 21, 2011, 6:34 AM
Is your query resolved.
Regards,
Praneeth
Sam HobbsPosted Jun 13, 2011, 8:30 AM
My guess is that HTTP uses TCP underneath.