All the Windows Communication Foundation (WCF) calls possible with the Microsoft .NET Framework 3.5 share two constraints. First, the port or pipe assigned to the service must be available. The application developer or administrator literally has to guess or have some way of reserving them. Second, the client must apriori know the address of the service endpoints, both the port number and the service machine, or the pipe name.
It would be great if the service could use any available address. The client, in turn, would need to discover that address at runtime. In fact, there is an industry standard-based solution that stipulates how that discovery takes place. WCF 4.0 comes up with a feature of discovering a new wcf service.
Discovery relies on the User Datagram Protocol (UDP). Unlike the Transmission Control Protocol (TCP), UDP is a connectionless protocol, and no direct connection is required between the packets sender and the receiver. The client uses UDP to broadcast discovery requests for any endpoint supporting a specified contract type. These requests are received by dedicated discovery endpoints that the services support. The implementation of the discovery endpoint responds back to the client with the address of the service endpoints that support the specified contract. Once the client discovers the services, it continues to invoke them as with regular WCF calls.
Via : MSDN Magazine