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 6948861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:52:42+00:00 2026-05-27T13:52:42+00:00

I am using WCF with duplex netTcpBinding and I want to send a message

  • 0

I am using WCF with duplex netTcpBinding and I want to send a message to all users connected currently to my service. I thought I could just create a callback contract and it would send a message to all the clients but it seems I am mistaken, and there isn’t a single server/service, each client gets its own service?

I have service with the name ‘Server’. Here is how I access the server from the client –

ServerClient client = new ServerClient();
string result = client.SendMessage(messageTextBox.Text);
client.Close();

I thought the ‘Server’ was a single object that handled all calls by my clients but then I’ve started a thread in the Server constructor and I found out that multiple threads get started because every time a client calls the Server, a new Server object is created.

So it seems each client has it’s own service/server.

  1. With that in mind how do I send a message to all my clients from the server?
  2. I thought the standard practise for accessing the server from the client was to get a proxy object, call the service functions, and then Close the proxy object like in the code above…but if I close the proxy object doesn’t it mean I have closed the connection between client and server and now the server won’t be able to make duplex callbacks to the client?
  • 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-05-27T13:52:42+00:00Added an answer on May 27, 2026 at 1:52 pm

    1) If you want all clients to share the same server, you need to make your service a singleton. Add this attribute to the class implementing your service (not the interface):

    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] 
    

    That said, I suspect that what you really want is a synchronized, static (thread-shared) instance of a List<ServerClient>. Then you would iterate over that to send a message to each client. With that design, you wouldn’t need a singleton server (just some good thread safety around the list).

    2) If the clients close their server proxies, the server will not be able to send them any messages. You need to keep the proxy open and stash them somewhere in the client. This design will of course significantly limit scalability.

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

Sidebar

Related Questions

I am designing a duplex channel wcf service using a custom binding. Currently, when
I'm in the process of writing a duplex WCF service using NetTcpBinding, and I've
I am using WCF to send some Linq objects across the wire. I want
I currently have a WCF Service with a CallBack Contract (duplex), and when I
I am creating a client service application using WCF duplex callback. The service sends
I am using WCF Data Service's processing pipeline do some message notification set-up prior
I am currently developing a duplex WCF service and I wish to test the
I am using WCF service in my application.All services are hosted as window service.
I have clients thats is connected to a duplex wcf service 24/6 it is
We are using WCF service on the client side we are planning to explicitly

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.