can wcf netTcpBinding callbacks return out of order

故事扮演 提交于 2019-12-11 05:53:40

问题


Consider a most simple client/server callback setup using netTcpBinding

Server:

_callback.BeginReceive(message, EndCallbackClient, null);//send message to client

Client :

[CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Single, UseSynchronizationContext=false)]
public class TradingClient : ITradingClientCallback, IDisposable
{
      public void Receive(Message message)
      {
            //handle message
      }

Please note <reliableSession ordered="true"/> is not in the WCF config

If, for example, the client side froze for a moment and a number of messages were sent from the server could the client Receive them out of order?

I have attempted to simulate this but have been unable to reproduce a scenario where they are out of order, however I had a random application error previously that indicated it might have happened.

Intuitively thinking about how sockets work I would have said this isnt possible but having a look at the client-side message callback reveals lots of code:

I know the messages are being sent in the correct order server-side and I know that if written to the socket in order they will be read off the socket in the correct order client-side - however as indicated by the red arrow theres lots of WCF code after the async socket read that I'm wondering if 2 (or more) messages read off the wire could result in out of order messages at the app level.

来源:https://stackoverflow.com/questions/39502340/can-wcf-nettcpbinding-callbacks-return-out-of-order

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!