Jump to content
Lindawb

wsocket send/receive compressed stream

Recommended Posts

Hello,

Is it possible to send/receive compressed tmemorystream with WSocket ? if yes how please. piece of code will help

 

Thank you

Share this post


Link to post

Exactly the same as sending an uncompressed memory stream, TWsocket has no idea what type of data you are sending.

 

If you mean how do you compress data in Delphi, there are lots of ways.  The ICS web server uses ZLIB to compress HTTP responses.

 

Angus

 

Share this post


Link to post

Thank you,

You mean first compress the stream with Zlib on Client side, then send it , on the server side read compressed stream , then decompress it and use it. are those steps correct ?

I tried it yesterday but for some reason didn't work.

 

Thanks again

 

Share this post


Link to post
1 hour ago, Lindawb said:

You mean first compress the stream with Zlib on Client side, then send it , on the server side read compressed stream , then decompress it and use it. are those steps correct ?

Those steps are correct.

Remember the  the receive side must know how many data to receive. You will likely receive several OnDataAvailable for significant amount of data. There is NEVER guaranteed relation between the number of Send() and the number of OnDataAvailable events. This is the biggest error many newbies are doing constantly.

Be sure to read this documentation : http://wiki.overbyte.eu/wiki/index.php/Asynchronous_Paradigm

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×