.Net client vs Java server with raw data

I am writing a .Net / C # client to a Java server on Solaris.

The Java server is writing out raw byte data in Gziped format that I need to extract, but I'm having trouble reading the data in the correct buffer sizes. I have read the post non-deterministically incomplete or complete and cannot read the second post anyway. I am reading bytes using the NetworkStream class with the DataAvailable property.

My guess is it might be related to the small / big end problem. Do I need to use a custom transform to change data from large to small Endian? Do I need to read the required bytes using the gzip header?

I used to use the same server with uncompressed protocol and had no problem using StreamReader with ReadLine function before, but this protocol was purely textual.

Edit: Unfortunately I have no choice since the remote server and protocol are given. Is the trailing part of the GZip format or do I only need to convert the header accordingly? The uncompressed data is pure UTF8-encoded strings with line breaks as separators.

0


a source to share


1 answer


The GZIP format is not complex. It is available in all its glory in a simple, accessible specification document, IETF RFC 1952 .

The GZIP format defines the bit order for bytes. It is not configurable with a flag for confirmation. The GZIP stream producer is responsible for conforming to the specification in this regard and the GZIP stream consumer as well.

If I were debugging this, I would look at the bytes on both ends of the wire and make sure the bytes coming in are the same as the bytes. This is enough to put the endia issues aside.



If you don't have a successful GZIP byte transfer, try transferring test data - 16 bytes 0xFF, then 16 bytes 0xAA, etc. etc. Then make sure it is data coming out from the other end.

Sorry, I don't know what you are talking about, I read the post non-deterministically incomplete or complete and cannot read the second post anyway. Second message? What's the second message? Specificity should not affect the amount of data you receive.

It seems to me that you are not sure that you are successfully transferring data. I would suggest that you check this before working on Endian and GZIP problems.

+2


a source







All Articles