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: sa...@eightvirtues.com phone: (770) 853-6271 ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user