Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7874541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:49:31+00:00 2026-06-03T02:49:31+00:00

I have a WCF server library and client[Winform], i launch the server using a

  • 0

I have a WCF server library and client[Winform], i launch the server using a self-host winform.

I want to let client to discover the active servers on LAN, in another way to get online servers IPAddresses in a list. i tried DiscoveryClient and UdpDiscoveryEndpoint and it worked this’s the code :

Client[Winform] :

 private void button1_Click(object sender, EventArgs e)
    {
        DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
        FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(IFileManager)));
        foreach (EndpointDiscoveryMetadata ep in findResponse.Endpoints)
        {
            listView1.Items.Add(ep.Address.ToString());
        }
    }   

Server[Winform] :

ServiceHost host = new ServiceHost(typeof(MainService));
private void button1_Click(object sender, EventArgs e)
    {
        if (button1.Text == "Start")
        {
            host.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
            host.AddServiceEndpoint(new UdpDiscoveryEndpoint());
            host.Open();
            button1.Text = "Stop";
        }
        else
        {
            host.Close();
            button1.Text = "Start";
        }
    }

but it didn’t work like i expect it!

  • Why do i have to give a specific Criteria to ClientDiscovery ? i have many interfaces, i just need the host address, not the address of the interface!
  • it takes too much time [about 15-20s] to get the list, isn’t suppose to be fast?

    UPDATE:
    I’ve developed a server discovery on TCP sockets before i used WCF, i used parallel threading that try/catch to connect and loop over 255 IPAddresses ex: (192.168.1.X), i tried it on LAN 5 servers[PC], the result was so perfect and fast , i sat a timeout (3 sec)
    but on WCF i dont know how would i accomplish this !!

    enter image description here

    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-06-03T02:49:33+00:00Added an answer on June 3, 2026 at 2:49 am

      Why do i have to give a specific Criteria to ClientDiscovery ? i have many interfaces, i just need the host address, not the address of the interface!

      That is the point of decoupling, the fact that all services that you need are on a single server is an implementation detail. That said, you could couple your client to your particular architecture, manually creating clients with the info from the MEX address received from the first result of the discovery process.

      it takes too much time [about 15-20s] to get the list, isn’t suppose
      to be fast?

      No, discovery is not supposed to be fast if you are looking for multiple instances of a service: the default timeout is 20s. Now, if you need only 1 instance of that service (which is most of the time), then you could tell the client explicitly to stop after finding the first service, by setting the MaxResults property of FindCriteria to 1. That is way faster than waiting for the timeout.

      For further information you can check this excellent article.

      UPDATE

      You can set the timeout via the FindCriteria.Duration property.

      UPDATE 2

      All the information you can get about the service is through the MEX endpoint. You could use a MetadataExchangeClient with the MEX address you get from the discovery and make use of the info in the MetadataSet you get back (see http://msdn.microsoft.com/en-us/library/ms730243.aspx, Retrieving Service Metadata), but I don’t know for sure what kind of information you will get back since I never used it this way.

      It depends on what you mean by status: WS-discovery has no concept of status that I’m aware of, either the service is there or not. Any other interpretation of this concept you have to implement yourself as an operation in your services.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    I have created WCF client/ server applications using calculator demo as mentioned in http://msdn.microsoft.com/en-us/library/ms734712.aspx
    I have WCF Class library, WCF Service Client and WCF Service Server in one
    I have a client/server style application which communicates using WCF which all works great.
    Introduction : I have a Server [ WCF service library ] and Client [
    I have a very simple wcf server. When a client uses an operation contract,
    I have a WCF service as part of a client/server application I am working
    I have a client app and a server app. The client calls a wcf
    I am trying to learn WCF. I have a simple client and server application
    I have a WCF server that is a library assembly. (I am writing it
    I'm using .NET 3.5 and WCF for developing a server-client application. Binding=BasicHttp. I'm working

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.