[Spread-users] connection naming

Matt Garman matthew.garman at gmail.com
Wed Mar 19 19:01:43 EDT 2008


On Wed, Mar 19, 2008 at 05:53:11PM -0400, John Keating wrote:
> The Java API source that's supplied limits the name for a Spread
> connection to 10 chars.  How do you large-scale Java users of
> Spread name your connections to avoid collisions?

We don't do anything this fancy, but here's an idea: you need to
encode multiple unique identifiers:

    - within a program: a static counter variable
    - on the system: process id
    - on the network: ip address

So, let's say you had more than 10 characters, you could encode
names like this:

192.168.1.1|25386|16

Where that format is

ip_address|pid|counter

But since you're limited to 10 characters, you have to "compress"
that.  What you could do is use something like base64.  I can't
remember if spread names are case sensitive or not.  But basically,
you determine the valid character set for spread names, and use that
as your base.  If you can get away with ascii characters 32 through
126, you've got base95.

I can't do the math, but I would *guess* that's enough to encode the
format above.





More information about the Spread-users mailing list