String Compression/Server--->Client

Started by
4 comments, last by benhus 21 years, 10 months ago
Hi, Who can help me with this? 1.I want to compress a string server-side in VB.NET or VC.NET 2. Then I want to send the string to the client(browser) 3. Then I want to uncompress the compressed string with java-script or vbscript. How can I accomplish this? Any help would be great. Thanks!
Advertisement
I would try a common compression technique like huffman coding. Unless your strings are long though you may end up sending more than you would have originally.

Also, try doing a google search for string compression.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
I did. I didn't manage to solve my problem. Now I'm asking the real die hard coding pro's;-)

[edited by - benhus on May 31, 2002 5:48:14 AM]
Hi!
May be I didn''t understand good your problem, but really I can see no TOO much difficulties

char str[512];
char compressedStr[512];
char *buffer = str;
int totalSend = 0;
int sendBytes = 0;
...
compressedStr = CompressString( str, compressedStr );
...
while( totalSend < wantToSend ){
if( ( sendBytes = send( socketFd, buffer, wantToSend - totalSend, 0 ) ) < 0 ){
exit(1);
}
totalSend+= sendBytes;
buffer+= sendBytes;
} // END WHILE

In fact, there is NO difference ( sending plain text ), is string compressed or not!

P.S. This code is not tested, I wrote it directly in browser

Lekha
Try feeding "huffman" in the MSDN search. The first mach I got (October 2001 version) is an article called "Data Compression and Visual Basic". It comes with full code, and lots of explanations.

Forever trusting who we are
And nothing else matters
- Metallica
Forever trusting who we areAnd nothing else matters - Metallica
Here''s a great article that talks about several different compression assemblies and shows some examples... here

This topic is closed to new replies.

Advertisement