ReceiveData() does not read anything if we donot have Thread.Sleep() in client code

Jun 24, 2011 at 7:08 PM

Hi,

 

I have scenario similar to the unit test case TestReceiveInLength() in the SocketServerTest.cs class. Client sends length of data in the command and then it immediately sends actual data. I am using following code in the ExecuteCommand method of my custom command.

 

int dataLength = GetDataLengthByParsingCommand(); // Here I parse the command and determine length of data

MemoryStream ms = new MemoryStream();

session.SocketSession.ReceiveData(ms, dataLength); // This call never returns

byte [] data = ms.ToArray();

 

But the ReceiveData() methods does not read anything and it goes into infinite loop. If I add delay of 100ms in the client code between sending command and actual (like what you did in TestReceiveInLength() test case), then it works correctly. But the problem is that I do not control client commands and cannot insert required delay.

 

Is this a limitation in the SuperSocket library? Any workaround in server code as I cannot modify client?

 

Regards,

--

Satish

Jun 25, 2011 at 1:52 AM

I'll check the issue you mentioned ASAP!

Jun 25, 2011 at 7:59 AM

Thank you for reporting this issue to me!

I have fixed it just now in the change set 68294.

Please get the latest source code to verify it!

Jun 25, 2011 at 4:02 PM
That was quick!! Thanks a lot.
I will test and let you know.
regards,
--
Satish

From: kerryjiang [notifications@codeplex.com]
Sent: Friday, June 24, 2011 11:59 PM
To: Satish Nikam
Subject: Re: ReceiveData() does not read anything if we donot have Thread.Sleep() in client code [SuperSocket:262704]

From: kerryjiang

Thank you for reporting this issue to me!

I have fixed it just now in the change set 68294.

Please get the latest source code to verify it!

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.