EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElSSLClient Buffer management

Posted: 11/27/2012 03:57:30
by Xavier Allaume (Basic support level)
Joined: 11/27/2012
Posts: 2


I'm trying to add an SSL layer on top of a working Silverlight 5 TCP communication with a proprietary server.

So far, I seem to be able to connect and send data to the server in SSL mode. Problems occur when I try to receive : this server sends me data in real time. I have a "listening thread" that should do:
- read the 8 first bytes of a message
- from there I know the length of the full message
- read the full message

My problem is that I'm well able to get the 8 bytes. They are put in "buffer" in the SecureServerOnReceive (one time 5 bytes, one time 3 bytes), but the SecureServerOnData event handler is never raised.

Do you think it is possible to do it?
How to force the decryption of those 8 bytes?
When does your system decide that it should decrypt what's in SecureServerOnReceive.buffer ?
Did I understand well that inBuffer only represents the socket buffer. So no decrypted data will ever be in it, only encrypted data?

Thank you very much for your help.
Posted: 11/27/2012 04:15:21
by Vsevolod Ievgiienko (Team)

Thank you for contacting us.

When any data is available for receiving you should call TElSSLClient.DataAvailable(). It will invoke TElSSLClient.OnReceive/OnSend if necessary and will fire TElSSLClient.OnData (if any data was received) that you can use to read decrypted data. TElSSLClient.OnReceive/OnSend operate with raw encrypted data.

For you task you should use some internal buffer where all incoming data should be saved and then your application should parse it to find the length of the full message etc.
Posted: 12/13/2012 10:13:57
by Xavier Allaume (Basic support level)
Joined: 11/27/2012
Posts: 2

Thanks a lot for your answer. It already helped a lot. Now my code seems working except when I receive very close triggers of TelSSLClient.OnData. I looks like the simple work of copying the buffer isn't done with the first call, and the second call already comes in and create me troubles.

Do you think of any way to serialize the trigger of TelSSLClient.OnData?
Posted: 12/13/2012 10:20:17
by Vsevolod Ievgiienko (Team)

Its hard to say why this happens without a code samples. Try to use some synchronization mechanism to work with the buffer.
Posted: 12/13/2012 10:43:09
by Eugene Mayevski (Team)

What buffer copying are you talking about? When OnData is fired, your need to pick the data from the buffer to your storage - after this the buffer is reused and new data is there.

Did you check the samples? We do have them and they do help to understand event-driven processing of data.

Sincerely yours
Eugene Mayevski



Topic viewed 1066 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!