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

Benoît Minisini gambas at ...1...
Mon Apr 4 10:20:44 CEST 2011


> 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.

And beware that the READ syntax has changed in Gambas 3. Look at the 
documentation!

Regards,

-- 
Benoît Minisini




More information about the User mailing list