I have a need to write a multiplatform app that does substantial amounts of asynchronous TCP socket data exchange under the covers. The data is not string data. It is binary and so best mapped to byte arrays. (assuming. Xojo works like most other languages)
I have not had any success with the built-in socket classes. I can exchange data with strings, but trying to to get the socket methods to work with a pointer to a byte array doesn’t seem to be viable.
If all this sounds pretty ignorant, it is. I know very little about Xojo, but have been around a long time and used Berkeley sockets, Winsock etc.
Are there any examples of how to do the above with Xojo classes, or do I need to invest in a library?
I’m looking at the TCPSocket class specifically, but your suggestion of a MemoryBlock is worth trying again. I did fiddle with that a bit, but didn’t get it to work the first time.
if the MemoryBlock object is a pointer by another name, then I know I did it wrong. I’ll give it another spin,
So what you’re saying is that I must use a String to carry the data for the socket?
Unfortunately, that won’t work well for my purposes. I need raw TCP socket methods that accept a pointer to a block of simple memory. Using a string has implications of the data being modified by encoding, for one. I don’t need a UTF-8 string, just a block of memory or byte array.
thats why string encoding is set to nil.
you can add a issue as feature request that we get overload methods that accepts a byte array or binary data.
with string as binary data is really ugly for many years.
I got part of a test app working last night, but it’s awkward. It may get better as I learn more about Xojo’s differences from C/++/# and VB6-style BASIC.
The app will control equipment in an observatory that is both expensive and potentially dangerous, so I’m being careful.
I’m trying Xojo and Flutter/Dart in parallel to see what’s possible.