I use udp packets (<1 kb) (in a similar way that rossum described) to
regulate the way that the nodes interact, but at certain times I need
to exchange some data between two nodes. The amount of data that I may
need to transfer could be from 1 kb to 1mb (pure text), and I was
wondering weather there was a quicker way (from zip) for the
compression/decompression.
Compression can't get much traction unless it has a fair size chunk to
work on. There is not as much repetition to find within an tiny
packet.
You might want to look into some type of dictionary compression where
you convert tokens to ints and DON'T transmit the meaning of the
tokens with each packet, but rather pre-transmit an entire dictionary
of what they mean.
In the simplest case, if your packets consisted of words separated by
a single space, create a dictionary of all the words you ever use,
sorted by frequency. Then assign numbers. The low number can get
8-bit codes, the next lowest 16-bit, the next lowest 24-bit.
Then encode your message as a string of ints. Each word includes the
space.
You can then turn GZIP compress on top of that.
see
http://mindprod.com/project/supercompressor.html