News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
Synchronous communication: howto?  
by al [alberto dot velo at softpeople dot ihnet dot it]
posted on 2005/11/02

Hello,
using latest library version, I'm trying to implement a SSL Client to talk synchronously with a server. I can connect, verify server certificate, send data and read responses from the remote server, but my problem is the response I read appears to be always the same (the first)!

E.g.:
- send MSG 1
- get RESPONSE1
- send MSG 2
- get RESPONSE1 AGAIN!

it looks like I always read the same response from server, while I'm assured I should get another kind of response for my MSG 2 (which btw is different from MSG 1).

I cannot understand what happens: should I move forward some pointer (position?) on my SecureSocket?
I get the same behaviour both using SecureSocket or SecureTcpClient, so I believe I miss something.

Does anybody use this great library for synchronous communications? Can anybody help?

by al [alberto dot velo at softpeople dot ihnet dot it]
posted on 2005/11/02

After futher testing, I could partially solve the problem: I need to read all data available on the socket, for example:

While nsStream.DataAvailable = True

sb = nsStream.ReadByte()
If sb = -1 Then Exit While
sb2.Append(ChrW(sb))
Debug.WriteLine("AVAIL: " & nsStream.DataAvailable)

End While


The strange problem is I have to put a delay in the loop: if I comment out the Debug line, I always get partial messages from the server! That is my code exits the loop before it has read all data.

Is there a timeout or something to play with to change this behaviour? I mean, what causes DataAvailable to become False?

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.