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

Kevin Fishburne kevinfishburne at ...1887...
Tue Apr 5 07:39:13 CEST 2011


On 04/04/2011 02:44 PM, Kevin Fishburne wrote:
> On 04/04/2011 04:20 AM, Benoît Minisini wrote:
>>
>> 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.
>

Alright, I've transformed all the networking code to the suggested 
solution, and it's so close to working I can smell it. While there is 
more code now, I like it better as it's easier to read (important!).

Some code:

   Dim id As Byte
   Dim type As Byte
   Dim data As String

   id = Read #udp As Byte
   type = Read #udp As Byte
   If Eof(udp) = False Then data = Read #udp, Lof(udp) - 2

Using "Lof(udp) - 2" as the length seems to remove bytes from the end 
rather than the beginning. I get an unwanted byte at the beginning as well.

Maybe this is a late April Fools joke about endianness? Other than that, 
the whole app is ready to put pixels on the screen again.

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