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

  • SEARCH
  • Home
  • 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 1077687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:36:44+00:00 2026-05-16T21:36:44+00:00

I’ve attempted the question different ways, check my profile for the other two questions

  • 0

I’ve attempted the question different ways, check my profile for the other two questions explaining the difficulty I’ve had with the approaches I’ve taken to this scenario. I’ll skip them here.

I just need an example (C# preferred) of a server calling back to a client (over a nettcp channel), the client calculates an answer, and returns a result.

  • The server’s calling thread is blocked until the client sends the response.
  • The server’s callback is prompted by some event, such as a timer, not a call by the client.
  • The client does not need to call back to the server within the context of the server’s callback, so there should be no deadlocking challenges.
  • The client may take (and for this exercise, should take) one or more parameters with which to perform the calculation
  • The client may return (and for this exercise, should return) a non-void result
  • The approach used should at least be compatible, if not implemented, with the ability to handle multiple clients in turn, including a subscribe() and unsubscribe() functionality.
  • This is not homework, it is to serve as an example of how to build a WCF-based subscriber/publisher server that supports (few) trusted clients with low latency server-client communication without polling and without throwing messages (over the fence)
  • I am specifically NOT interested in solutions that involve (IsOneWay = true), unless it becomes clear that I am very confused about its meaning and its consequences.

Thanks!

  • 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-16T21:36:45+00:00Added an answer on May 16, 2026 at 9:36 pm

    Check this article on CodeProject. This describes basic example of callbacks. Few things that you may have to change:

    • On callback contract, operations marked as one way – this is to avoid blocking of server due to bad client (a recommended practice). But if you must block the server then you need to remove one way. Note that if you are going to callback multiple clients one by one then you may have to callback each one on different thread other wise first client will block callback to next client.

    • When to invoke callback is really a server implementation. The given example maintains a list of client callback channels whenever client joins (or subscribes in your requirement). Now this list can be used to invoke callback in any way you want. So you can invoke callbacks on timer by simply iterating over the list. Note that you have to ensure thread-safe access to the list.

    • If client has to return some result in callback then again OneWay cannot be used.

    • As mentioned earlier, subscribe means simply adding to the list (join party in example) and unsubscribe means removing from the list (leave party).

    Edit:

    I have taken the source code from the example sighted and modified it as follows:

    Added a method Echo in callback contract:

    public interface IBeerInventoryCallback
    {
       ...
    
        [OperationContract]
        string Echo(string message);
    }
    

    Invoked Echo from service when someone left the party and printed response from client on console. And it worked w/o any issues.

    Note that this example uses VS generated client proxy that inherits from System.ServiceModel.DuplexClientBase<T> which makes client code much simpler. Perhaps, you should try it.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.