I need some support for the implementation of a file transfer via the TCPSocket...
On the client side, a file is read in, which is then to be stored in a directory on the server side.
At the moment I'm a little bit hung up on converting the file content back and forth.
The message to be transmitted (including protocol information) is put together in a Xojo.core.MutableMemoryBlock. I'll be fine until then.
The string that I want to transfer with "write()" is generated from a memory block as shown below:
Public Function ConvertMBToString(dst As Xojo.Core.MemoryBlock) as String Return(CType(dst.Data, MemoryBlock).StringValue(0, dst.Size)) End Function
On the server side, this CString also arrives wonderfully in the ReadAll() of the TCPSocket.
But what happens then?
How do I get the string returned by ReadAll() converted back into a (Mutable)MemoryBlock, so that I can disassemble the message again?
Is the workaround with the classic MemoryBlock the only way?
dim mbc as MemoryBlock = Input dim mb as new Xojo.Core.MemoryBlock( mbc, mbc.Size )
Thank you very much for your support.