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

2011-04-09 Thread Kevin Fishburne
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. I

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

2011-04-09 Thread Kevin Fishburne
On 04/08/2011 04:49 PM, Benoît Minisini wrote: >> Kevin Fishburne wrote: >> >> Ahh, I understand a little better. I don't know much about endianness, >> so please excuse my ignorance here. >> >> ... >> >> While it would be slow, I could just write functions for flipping the >> byte order of charact

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

2011-04-08 Thread Benoît Minisini
> Kevin Fishburne wrote: > > Ahh, I understand a little better. I don't know much about endianness, > so please excuse my ignorance here. > > ... > > While it would be slow, I could just write functions for flipping the > byte order of characters in a string. That would work fine for the > client b

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

2011-04-08 Thread Doriano Blengino
Il 08/04/2011 09:04, Kevin Fishburne ha scritto: > On 04/08/2011 02:32 AM, Doriano Blengino wrote: > >> >> Endiannes refers to the order the bytes are kept in memory, when a >> numerical multi-byte value is involved. Strictly speaking, strings are >> not affected. For example, human beings are

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

2011-04-08 Thread Kevin Fishburne
On 04/08/2011 02:32 AM, Doriano Blengino wrote: > Kevin Fishburne ha scritto: >> >> Ahh, I understand a little better. I don't know much about endianness, >> so please excuse my ignorance here. When reading socket data into a >> string how is the data affected exactly? I can think of a few possibil

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

2011-04-07 Thread Doriano Blengino
Kevin Fishburne ha scritto: > On 04/07/2011 12:20 PM, Benoît Minisini wrote: > >> When you write the data to the socket, all data are converted from the CPU >> endianness (little endian for Intel/AMD) to the network endianness (big >> endian >> by definition). >> >> When you read the data from

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

2011-04-07 Thread Kevin Fishburne
On 04/07/2011 12:20 PM, Benoît Minisini wrote: > > When you write the data to the socket, all data are converted from the CPU > endianness (little endian for Intel/AMD) to the network endianness (big endian > by definition). > > When you read the data from the socket, the data must be converted bac

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

2011-04-07 Thread Benoît Minisini
> > > > Because sockets are big endian, not little endian as the CPU. I think you > > have to use READ to decode the messages as soon as you receive them. > > > > If you want to process them later, you can use a Variant[] to store the > > decoded data instead of a String storing the undecoded dat

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

2011-04-07 Thread Kevin Fishburne
On 04/07/2011 05:05 AM, Benoît Minisini wrote: >> On 04/05/2011 03:34 AM, Benoît Minisini wrote: On 04/05/2011 01:39 AM, Kevin Fishburne wrote: > 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 >

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

2011-04-07 Thread Benoît Minisini
> On 04/05/2011 03:34 AM, Benoît Minisini wrote: > >> On 04/05/2011 01:39 AM, Kevin Fishburne wrote: > >>> 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 eas

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

2011-04-06 Thread Kevin Fishburne
On 04/05/2011 03:34 AM, Benoît Minisini wrote: >> On 04/05/2011 01:39 AM, Kevin Fishburne wrote: >>> 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 rea

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

2011-04-05 Thread Kevin Fishburne
On 04/05/2011 03:54 AM, Kevin Fishburne wrote: > http://www.youtube.com/watch?v=cJPa8dGBxfM > > I'll get back to you in the morning if it's still not working. Damn.. Works. Thank you. -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770)

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

2011-04-05 Thread Kevin Fishburne
On 04/05/2011 03:34 AM, Benoît Minisini wrote: > > Not strange if you read the doc carefully. :-) > > When using "WRITE #Stream, AString As String", the length of the string is > always written before the string contents. > > To just write the string contents, you must use the second syntax of WRIT

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

2011-04-05 Thread Benoît Minisini
> On 04/05/2011 01:39 AM, Kevin Fishburne wrote: > > 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

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

2011-04-04 Thread Kevin Fishburne
On 04/05/2011 01:39 AM, Kevin Fishburne wrote: 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

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

2011-04-04 Thread Kevin Fishburne
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

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

2011-04-04 Thread Kevin Fishburne
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() >> >> D

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

2011-04-04 Thread Benoît Minisini
> 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

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

2011-04-03 Thread Kevin Fishburne
On 04/03/2011 08:46 PM, Benoît Minisini wrote: > Finally I come with a solution. Well I hope. > > I added three new methods to the Stream class (and so to its child classes: > File, Socket, UdpSocket...) in revision #3730. > > Stream.Begin(), Stream.Send() and Stream.Drop(). > > All WRITE instructi

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

2011-04-03 Thread Benoît Minisini
> I'm finding that the task of replacing the Mk$ functions with structures > for UDP packet client/server transactions is a massive undertaking. So > far it's affecting every part of my project that constructs, parses, > sends and receives data. As a consequence the network code is going from > doz

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

2011-04-03 Thread Doriano Blengino
Il 03/04/2011 22:07, Kevin Fishburne ha scritto: > On 04/03/2011 02:27 PM, Benoît Minisini wrote: > >> OK... I should have read all that more carefully, as I have said rubbish. >> >> Sending a message to an UDP socket can only be done with a string or a >> structure. If you use several WRITE in

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

2011-04-03 Thread Kevin Fishburne
On 04/03/2011 09:33 AM, Jussi Lahtinen wrote: >> With respect to Doriano, how would one use the memcpy() statement in >> GAMBAS? I see from Wikipedia that "void *memcpy(void *dest, const void >> *src, size_t n);" shows the syntax in C. My two questions are, how do >> you call external library funct

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

2011-04-03 Thread Kevin Fishburne
On 04/03/2011 02:27 PM, Benoît Minisini wrote: > > OK... I should have read all that more carefully, as I have said rubbish. > > Sending a message to an UDP socket can only be done with a string or a > structure. If you use several WRITE instructions, you will get one message by > WRITE. Not a good

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

2011-04-03 Thread Benoît Minisini
> > I'm finding that the task of replacing the Mk$ functions with structures > > for UDP packet client/server transactions is a massive undertaking. So > > far it's affecting every part of my project that constructs, parses, > > sends and receives data. As a consequence the network code is going fr

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

2011-04-03 Thread Doriano Blengino
Il 03/04/2011 15:33, Jussi Lahtinen ha scritto: >> With respect to Doriano, how would one use the memcpy() statement in >> GAMBAS? I see from Wikipedia that "void *memcpy(void *dest, const void >> *src, size_t n);" shows the syntax in C. My two questions are, how do >> you call external library fun

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

2011-04-03 Thread Jussi Lahtinen
> With respect to Doriano, how would one use the memcpy() statement in > GAMBAS? I see from Wikipedia that "void *memcpy(void *dest, const void > *src, size_t n);" shows the syntax in C. My two questions are, how do > you call external library functions in gb, and how would you translate > the C sy

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

2011-04-03 Thread Benoît Minisini
> On 04/01/2011 05:24 AM, Benoît Minisini wrote: > > Using a structure just allow you to directly use the READ/WRITE > > instruction because they have a build-in serialization support. But as > > you noticed, handling a lot of different structures is not handy! > > Yes, because I need to keep a tr

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

2011-04-02 Thread Kevin Fishburne
On 04/01/2011 05:24 AM, Benoît Minisini wrote: > Using a structure just allow you to directly use the READ/WRITE instruction > because they have a build-in serialization support. But as you noticed, > handling a lot of different structures is not handy! Yes, because I need to keep a transaction hi

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

2011-04-01 Thread Benoît Minisini
> > Another stab in the dark: could you have a Object array, and then an > class for each > type of message which knows how to pack and unpack itself to the wire > using an internal > structure > > Ian > Yes! -- Benoît Minisini

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

2011-04-01 Thread Benoît Minisini
> I'm finding that the task of replacing the Mk$ functions with structures > for UDP packet client/server transactions is a massive undertaking. So > far it's affecting every part of my project that constructs, parses, > sends and receives data. As a consequence the network code is going from > doz

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

2011-04-01 Thread Kevin Fishburne
On 04/01/2011 04:12 AM, Doriano Blengino wrote: > If I were Benoit, I would have leaved those mkxxx in place, neglecting > the agnosticism.They were dirty things time ago; they still would be > dirty things; nobody is perfect; if you don't like them, don't use them. They are "dirty". I proposed wr

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

2011-04-01 Thread Doriano Blengino
Kevin Fishburne ha scritto: > On 04/01/2011 01:15 AM, Bruce Bruen wrote: > >> On Friday, April 01, 2011 01:17:50 PM Kevin Fishburne wrote: >> >>> I'm finding that the task of replacing the Mk$ functions with structures >>> for UDP packet client/server transactions is a massive undertaking.

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

2011-04-01 Thread Ian Haywood
On Fri, Apr 1, 2011 at 4:36 PM, Kevin Fishburne wrote: > On 04/01/2011 01:15 AM, Bruce Bruen wrote: >> On Friday, April 01, 2011 01:17:50 PM Kevin Fishburne wrote: >>> I'm finding that the task of replacing the Mk$ functions with structures >>> for UDP packet client/server transactions is a massiv

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

2011-03-31 Thread Kevin Fishburne
On 04/01/2011 01:15 AM, Bruce Bruen wrote: > On Friday, April 01, 2011 01:17:50 PM Kevin Fishburne wrote: >> I'm finding that the task of replacing the Mk$ functions with structures >> for UDP packet client/server transactions is a massive undertaking. So >> far it's affecting every part of my proj

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

2011-03-31 Thread Bruce Bruen
On Friday, April 01, 2011 01:17:50 PM Kevin Fishburne wrote: > I'm finding that the task of replacing the Mk$ functions with structures > for UDP packet client/server transactions is a massive undertaking. So > far it's affecting every part of my project that constructs, parses, > sends and receive

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

2011-03-31 Thread Dag-Jarle Johansen
Ok Kevin, new to me that is a game. I have read an notified your comprehends Nevertheless, if you want me to, let me take a part of your Gambas-Experiences, they might be good for both of us. regards, Dag-Jarle 2011/4/1 Kevin Fishburne > On 04/01/2011 12:17 AM, Dag-Jarle Johansen wrote: > > Kev

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

2011-03-31 Thread Kevin Fishburne
On 04/01/2011 12:17 AM, Dag-Jarle Johansen wrote: > Kevin, I have no idea. But in lack of business and money enough to live for, > I would like to help you, if I am a good enough programmer. I have NOT made > programs in your kind until now; my kind of networking was just to have the > right client

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

2011-03-31 Thread Dag-Jarle Johansen
Kevin, I have no idea. But in lack of business and money enough to live for, I would like to help you, if I am a good enough programmer. I have NOT made programs in your kind until now; my kind of networking was just to have the right client idle or not. IF you want me to, I would like to spend so

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

2011-03-31 Thread Kevin Fishburne
I'm finding that the task of replacing the Mk$ functions with structures for UDP packet client/server transactions is a massive undertaking. So far it's affecting every part of my project that constructs, parses, sends and receives data. As a consequence the network code is going from dozens of