2

I have a callback api with oneway = true, netTCPBinding. And service calls callback on client what i observe was that data arrive in out of order fashion!

Service:

[OperationContract(IsOneWay = true)]
SendData(DateTime time, double[] data)

void SendData()
{
    while(data = GetNextData() != null)
    {
         SendData(DateTime.Now, data); 
    }
}

Client: [CallbackBehavior(UseSynchronizationContext = false)]

public class Data
{
    public DateTime time;
    public double[] data;
}

ConcurrentQueue<double[]> queue;
SendData(DateTime time, double[] data)
{
    queue.Enque(new Data (time, data));
}

I consume queue in another thread, what i observe is "time" which tells me time in service when sendData(..) called is out of order of data in queue! [SendData(..) in service is called in loop and in single thread, which make sure that time is always in increasing..

1) Why i am getting out of order delivery of data where as TCP provides ordered delivery of packet. Is the problem in my code or I need WCF - reliable session?

2) What is the purpose of setting reliable session as enabled with Order as true in case of TCP which already provides in order delivery.

3) Is there any alternative to reliable session order = true?

s.s
  • 138
  • 8
  • Can you provide the code that issue the calls for `SendData`? – Tomer Arazy Jul 05 '15 at 18:50
  • @Tomer Arazy : code looks something like this, running in one thread. while(dataExists = GetNextData() != null) { SendData(DateTime.Now, dataExists); } – s.s Jul 06 '15 at 11:06
  • @s.s did you find an answer for this elsewhere? – wal Sep 15 '16 at 01:12
  • @wal Yes, once the callback function is called on the client side there is no guarantee of ordered processing, if we need ordered delivery of packets at application layer then reliable session must be turned on. Or we have to write our self some ordering mechanism. – s.s Sep 18 '16 at 05:40
  • @s.s thanks do you have a source or reference for this? I asked this question just recently and am looking for an authority on the subject http://stackoverflow.com/questions/39502340/can-wcf-nettcpbinding-callbacks-return-out-of-order – wal Sep 18 '16 at 23:45

0 Answers0