Archived Forum Post

Index of archived forum posts

Question:

ActiveX Socket Behaves Differently Between VB6 and VB.net

Aug 19 '16 at 06:39

Using the ActiveX ChilkatAx-9.5.0-win32.dll version 9.5.0.58. The dll was implemented in both a VB6 and VB.net test app. Each app is used to send commands to an Audio/Video (AV) device. The commands being sent, from both apps, are identical. Please note that the two apps are not run at the same time. The commands are sent via the SendString method with the StringChartset property set to utf-8. When the VB.net test app is used the expected acknowledgement, from the device, is received. However, the VB6 app does not get any acknowledgement back. I set up an emulation app to receive a command and echo the command back. Both app worked as expected. The sent commands were echoed back in both cases. This showed me that the VB6 app is capable of receiving acknowledgement messages. Any suggestions? Thanks, RBO


Answer

The architecture of Chilkat is that there is a single C++ native implementation that is used across all operating systems, and by all programming languages. For every programming language (.NET, C++, Java, ActiveX/COM, Objective-C, etc.) there is a thin layer of generated code (generated from an internal API specification) that marshals input args to the inner C++ call, and marshals return values back.

Therefore, given that both the ActiveX and .NET DLLs use the same implementation, the only difference can be the marshaling of args and return values. If a problem exists in the generated thin-layer, then it would be a problem common across the entire API (for example, if byte arrays are not passed correctly in .NET calls) and this would be spotted very quickly by hundreds if not thousands of users..


Answer

Are you sure you're sending a UTF-8 byte array in VB6? If you are sending a string, then it is going to be 2-byte per character Unicode AFAIK.