[Gambas-user] gb3 RC1: using structures to replace the loss of Mk$ functions

Kevin Fishburne kevinfishburne at ...1887...
Sun Apr 10 05:25:37 CEST 2011


On 04/08/2011 04:14 PM, Doriano Blengino wrote:
>
> Perhaps I got it - but this should be confirmed by Benoit, I think.
>
> On the client side, you can receive a packet as a string. Then you can
> use a memory stream to read from the string, so the endianness is coped
> with by the stream object. It should work. But this is only on the
> client side, the server already uses a stream to send the data, right?

I decided near the beginning to make the client and the server the same 
program, allowing the user to run it as either. This was so they could 
share code easily, since networking and conversion functions are shared 
between them. The networking code and the way transactions are sent, 
received and processed are the same between the client and server.

Like with Benoît's suggestion, "memory stream" will be filed away for 
possible using during optimization. Sounds cool...some way to read/write 
values directly from memory? Seems sorta like the memcpy C function but 
native to gb.

> BTW, I think that it is not true that you can not use a Variant. A
> Variant can be a string, and string's sizes are limited only by the
> available memory. I think you use a string anyway, even when you receive
> tiles and other big objects. With respect to a true string, a Variant
> wastes a little amount of memory, which is neglectable especially when
> using big chunks of data. The problem is that I don't see how a variant
> could help you...

Agreed. Unless a variant somehow alleviates the endianness problem then 
it's no better than a string.

> The trick with string + memory stream should work for you

In the file cabinet. :)

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list