On Mar 27, 2010, at 11:36 PM, Manohar Vanga wrote:

On Sat, Mar 27, 2010 at 10:03 AM, coderbean <[email protected]> wrote: I am not sure if I understand the complete requirements, but from my understanding...

If you guarantee that the module name will be unique, you can hash the module name at the compile time using templates and use that as ID. A good hashing algorithm guarantees unique hash value so that should ensure that the ID remains unique. Let me know if you need any help in this.

Hashing is a good way to do it but the application requires high loads of traffic and a hash value would bloat the message size quite a bit compared to a measly integer.

You hash a string to an integer, so that the generated integer is unique.


If the module at the client side has to communicate with same module at server side, hand-shake is mandatory. You might want to share version info of the module or some other such information that is required in further communication. So, why don't you let the server assign ID? Client never assigns ID for modules which have corresponding server modules, it registers the module with the server [or otherwise] and requests the server to assign ID. If there is no corresponding server side module, then client can assign its own ID. Something like - all the server assigned ID's will have most significant bit set while the client side ID's won't. That way they won't conflict.

This is something I didn't consider because my initial design was based on hard coded meessage ID's. I've just cleaned it up recently. Let me think of the implications specific to my application and get back to you!


That's fine.

Thanks
Manohar

Reply via email to