On 01/15/2011 12:58 PM, Benoît Minisini wrote: >> On 01/15/2011 09:14 AM, Benoît Minisini wrote: >> >> Thanks it is more clear now, because the example of UDP usage of these >> functions i did not understand it. >> >> Beware that these functions may be removed, and replaced by another way of >> forging UDP packets. >> >> [[1]Noooooooo...] ;) Please let us/me know if you do, or what the >> replacements will be. >> The functions are the logical extension of ASC() and STR(), which I'm >> guessing you'll be keeping out of respect for or compatibility with >> old-school BASIC. Maybe ASC() and STR() could be removed, with the >> documentation pointing to the new functions? ASC() and STR() could also >> be used to forge UDP packets and still suffer from the endianness issue. >> -- >> Kevin Fishburne >> Eight Virtues >> www: [2]http://sales.eightvirtues.com >> e-mail: [3]sa...@eightvirtues.com >> phone: (770) 853-6271 >> > Here is what I thought when I have written that: > > - Gambas has now structures. > - Structures contents can be written to a stream by the WRITE instruction. > - Streams have support for endianness. > > Now, when you write something to an UDP socket, one writes equals one message, > so you cannot send a message with successives writes. > > Hopefully, when writing a structure, a temporary string is used for storing > the intermediate writes, and so only one write is finally done to the UDP > socket. > > So, please, can you try that? Instead of using strings, create one structure > for each message you send to your UDP socket, fill the structure with the > message contents, and use the WRITE instruction to send the structure to it. > And tell me if it works! :-) And if you finally find it cleaner or not. > > Thanks in advance. > > Regards, > I read the documentation on structures and they look interesting if not tricky. Sounds like a good solution to sending groups of variables of differing datatypes as a single UDP packet, but who knows until I change my code to use structures. Will maintain current build for now to keep moving forward, but will use structures if they are more efficient or the other functions are removed. ASC() and STR() should be removed then, too. Kidding...
-- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user