Android Question DeflateStream

realblue

Member
Licensed User
Longtime User
Hi everybody. I am using the VB code below to compress some information in order to send trough UDP :
Code: Copy
Public Shared Function Compress(ByVal data As Byte()) As Byte()
  Dim ms As New MemoryStream()
  Dim ds As New DeflateStream(ms, CompressionMode.Compress)
  ds.Write(data, 0, data.Length)
  ds.Flush()
  ds.Close()
  Return ms.ToArray()
End Function

When I receive the bytes I decompress as shown below :
Code: Copy
DeflateStream(ms, CompressionMode.Decompress, True)

This method is fine as long as receiving party is a Windows client. But I need to implement an Android client that listens to UDP port as well and process received information. So how can I convert this piece of code to B4A or is there another common library that I can use it both Windows and Android?

Thanks in advance.
 
Back
Top