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 receives data. As a consequence the network code is going from > dozens of lines to hundreds, and I'm beginning to see that the actual > logic of network operations will need to be changed as well. > > I can deal with all of that, but right now I'm just trying to make it > work without the program becoming ridiculously complex and/or inefficient. > > I have up to 256 different transaction types shared by the client and > server. Each one is represented by a different structure containing > multiple datatypes. The structures range from a few bytes to many KB of > data. Values are assigned to a structure when a transaction must be > sent, then the structure is sent by the client or server. The recipient > then parses the structure and assigns its values to different variables. > > Each transaction has an "ID" which represents the order in which it was > sent and where it should be assigned in the recipient's transaction > queue array. This ensures that transactions received out of order are > processed in order. Both the client and the server have their own > transaction queues that store the transactions they receive. > > The transaction IDs range from 0-255, so originally I had a transaction > queue array that was something like this: > > Public ts[256, 3] As String ' Server transactions (256: Queue Position, > 3: Status, Type, Data). Status = "new" or "old". > > Each element of the transaction queue array was generic, meaning it > could store any transaction type regardless of what data it contained. > Now that I'm using structures, the transaction data is uniquely > represented. Instead of a generic "data" string element that I could > create/parse with MkSingle()/Single@(), I have a unique structure. How > can I store a unique structure in a generic array of structures? Is this > possible? Right now I'm thinking I need to have transaction queue arrays > of [256,256] structures (65536 structures) to accommodate this. Not so > good when any particular structure could be up to 198 KB + header. > > Any ideas are appreciated, as this is starting to make me postal! :) Pure stab in the dark. Could you write a "helper" class to replace the Mk$ functions, then you'd only have to develop a limited amount of code and leave the working code alone? -- best regards Bruce Bruen
------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user