[Gambas-user] gb3 RC1: using structures to replace the loss of Mk$ functions
Kevin Fishburne
kevinfishburne at ...1887...
Mon Apr 4 20:44:51 CEST 2011
On 04/04/2011 04:20 AM, Benoît Minisini wrote:
>> Excellent, that's an elegant solution. Thanks! Is it possible to read
>> one or more values from the beginning of the packet normally, then read
>> the remaining data into a single string? Something like this:
>>
>> Public Sub UDP_Read()
>>
>> Dim id As Byte
>> Dim type As Byte
>> Dim data As String
>>
>> Read #udp, id As Byte
>> Read #udp, type As Byte
>> Read #udp, data, Lof(udp) - 2
>>
>> End
>>
>> If this works (and I don't see why it wouldn't), then everything is
>> fixed. I can have a transaction array that can store any transaction
>> type by saving the "payload" as a string and decoding it later with the
>> *@() functions.
>
> You should better decode the packet directly with READ instructions.
I would except the incoming transactions aren't processed immediately.
They are stored in sequence by ID in a transaction queue array for later
processing. Each client stores 256 server transactions and the server
stores 256 client transactions for up to 2000 clients. That's why the
payload has to stay a string until it is processed; otherwise it would
have no way of being stored in an array.
> And beware that the READ syntax has changed in Gambas 3. Look at the
> documentation!
I've been using gb3 for a while now and look at the docs often. :)
I'll compile the latest revision of gb today and test out the new stuff.
Good luck with gb3, I have a feeling it's coming very soon.
--
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