3

Does someone know how to set the timeout for discovery. The default value is like 10-15s and it seams a bit long...

On witch side does it have to be configured? Service? Client?

Service:

            // Add a ServiceDiscoveryBehavior
            host.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
            // Add a UdpDiscoveryEndpoint
            host.AddServiceEndpoint(new UdpDiscoveryEndpoint());

Client:

    EndpointAddress endPoint = null;

    endPoint = FindCalculatorServiceAddress();

    static EndpointAddress FindCalculatorServiceAddress()
    {
        // Create DiscoveryClient
        DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());

        // Find IStringReverser endpoints            
        FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(IStringReverser)));

        if (findResponse.Endpoints.Count > 0)
        {
            return findResponse.Endpoints[0].Address;
        }
        else
        {
            return null;
        }
    }

Thanks in advance

John
  • 43
  • 5
  • By the way, if you use the `FindAsync()` method with the `FindProgressChanged` and `FindCompleted` events rather than the synchronous `Find()` method, the `FindProgressChanged` event is fired as soon as the endpoint results come in, meaning you'll have access to them immediately instead of having to wait to the end of the search. You can choose to do `CancelAsync()` if you're not interested in more results, or just let it run until it times out, at which point `FindCompleted` fires. – Alex Feb 06 '15 at 06:47

1 Answers1

4

I believe you need to set the Duration property of FindCriteria

FindCriteria.Duration Property

MLF
  • 626
  • 4
  • 15