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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:24:01+00:00 2026-05-13T20:24:01+00:00

The client sends a lot of messages to the server from a single thread,

  • 0

The client sends a lot of messages to the server from a single thread, over a single WCF channel.

The client sends the message with BeginMyMethod(x, b) as it does not wish to block while they get processed.

We have reliable messaging turned on, as we don’t wish to lose any messages, or have them get out of order.

However the messages are being despatched on multiple threads on the server, so are being process out of order.

We can’t have the server being single threaded, as we don’t wish a long running request from one client to block other clients.

So I just wish to process all the messages that come from a single client (over a single channel) in order with only one message from each cleint being processed at a time.

This would be easy for raw socket programming, however how to I get WCF to work as I wish?


I am now thinking that ConcurrencyMode.Reentrant does not behave well when used with InstanceContextMode.Single If I set use ConcurrencyMode.Single the messages are kept in order, but my call-backs deadlock.

(The test that gets the messages out of order has no callbacks and does not make any outgoing WCF calls, so I would expect ConcurrencyMode.Reentrant to behave the same as ConcurrencyMode.Single in that given test, but it does not)

I a not using any WCF config files, the code is:

serviceHost = new ServiceHost(this);
serviceHost.AddServiceEndpoint(
   typeof(IAllEngineManagersAsyncCallbacks),
   new NetTcpBinding(SecurityMode.None, true),
   endPointAddress);
  • 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-13T20:24:02+00:00Added an answer on May 13, 2026 at 8:24 pm

    I have now worked round this problem by:

    • Changing all my call-backs from the server to the client to be OneWay
    • Using a dispatcher in the client before passing on any callback from the server, so client code never calls the sever from within a call-back
      • The client call-back object is marked with CallbackBehavior(UseSynchronizationContext=false, ConcurrencyMode=ConcurrencyMode.Single)
      • When running in Winform or WPF I use SynchronizationContext.Post to depatch the callbacks
      • When the cleint is a Console or a Windows server I use a custom depatcher.
    • So letting me use ConcurrencyMode.Single on both the server and the client.

    It is now working as expected.
    (BeginMyMethod(x, b) is still being used to send messaged from the client to the server)

    (ConcurrencyMode.Reentrant seems to sometimes release the lock even when the WCF call is not made on the some thread that is processing the incoming message, it is just not a useful as Reentrant was in DCOM)

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

Sidebar

Related Questions

somebody know what is encoding type of message that client sends to websocket server?
I need to send large binary(2Gb-10Gb) data from one pc(client) to another pc(server) over
Here's as far as I understand it: Client & Server make connection Client sends
I have a server, and a client. A client sends a request. The request
Writing a client application that sends images to a server via a webservice. As
I am writing a client for a server that typically sends data as strings
I'm about to design a client application and the server part is not designed
hey guys, here's a simple scenario NServiceBus Client/Server setup. The Message is a custom
I have server application based on Netty. It decode message (from json) and send
I learned an example of usage of sockets. In this example a client sends

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.