Login  
Search All Forums
Dart Home | PowerTCP SSL for ActiveX | Custom Development Reply | PowerTCP SSL for ActiveX Topics | Forums   
AuthorForum: PowerTCP SSL for ActiveX
Topic: Receiving Binary Data with SecureTcp & C++
TimAtVistus

From: Milton Keynes, USA
Posts: 2
Member Since: 12/17/03
posted December 17, 2003 8:17 AM

Hello. I'm using SecureTcp with Visual Studio 6 and C++ to communicate with a Linux server. Everything works really well until I attempt to download a particular binary file from the server - two bytes of received data are incorrect. The code to receive data is as follows:

...
BSTR BStr = ::SysAllocStringByteLen(NULL, 0);  // Reallocate later
COleVariant Var;
::SysReAllocStringLen(&BStr, NULL, SecureTcp->ReceiveBufferCount));
Var.Clear();
Var.vt = VT_BSTR;
Var.bstrVal = BStr;
DWORD Length = SecureTcp->Receive(Var);
if(Length > 0)
...

The hexadecimal data received in Var.bstrVal is:

...BC 00 EF 00 19 20 52 01 0D 00 0A 00...

but should be (and I know this for certain):

...BC 00 EF 00 92 00 8C 00 0D 00 0A 00...

I would have expected every other byte to be zero since the received (8 bit byte) data is presented in Unicode but that is not the case for the incorrect data.

I realise this is a fairly nebulous question but is this likely to be a problem in the SecureTcp tool to do with Unicode conversion or am I doing something wrong in my C++ receive code? It seems simple enough to me and, as I say, it works fine under all other circumstances. Incidentally, where the data is incorrect that is the only part preceeded by an 'F'.

Tim Rasmussen
Vistus Technologies
TimAtVistus

From: Milton Keynes, USA
Posts: 2
Member Since: 12/17/03
posted December 18, 2003 12:36 PM

Sorry - I've now fixed it. I managed to get SAFEARRAYs working instead of BSTRs and the data comes through fine.

An example would have saved a lot of head scratching but I appreciate you have a lot of different products and environments to support.
Reply | PowerTCP SSL for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX