Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

benhus

String Compression/Server--->Client

This topic is 6017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!