quote:
woudl work, however if the length of the binary string is beign determined ahead of time
And that is of course the only way it will work.

Maybe we should avoid the word "string" to describe this, as it is confusing the issue.

What you need is an abitrary binary object. It is not a string. Handling and object as a string is simply taking a binary object an adding some rules to it - the simplest of which is that it is null terminated.

A "string" object is a very simple beast. It has a start (pointer to memory location) and content (the string data). The size of the string is determined by the data (and available memory). This means that a string is represented in coding terms by a simple pointer to memory and nothing else.

To contain arbitrary binary data, the object needs more information contained within the object itself. Specifically it requires an "end" or more likely a "length" attribute. This must be a property of the object, as it needs to be passed along with it.

This is going to make things very complicated, as something like KiXtart can deal with binary objects represented as COM automation objects, but something like Winsock will be expecting two simple values - a pointer and a length.

What you could try is constructing an automation object which creates a buffer for arbitrary binary data, and a length parameter. Assign values to it using an array or C-escaped type declarations, and then pass the individual parts on. You won't be able to manipulate them in KiXtart (unless you follow the string rules) but you may be able to pass them for handling by COM.

A final note about Winsock. When I was looking at using it some time ago I had problems. Either the library wasn't initialising, or wasn't dealing with I/O because it was expecting to be dealing with event driven code. That was why I ended up playing with the Catalyst product.

The best solution for this is to code a wrapper COM Automation object which calls the socket library directly. The wrapper object can include all the support routines you need for automatically converting to and from native KiXtart types.

As a spooky aside this is exactly what I was working on before real work intervened and I had to mothball it.