Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8171741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:33:09+00:00 2026-06-06T21:33:09+00:00

I am trying to send serialized,compressed data over a tcp connection using protobuf-net and

  • 0

I am trying to send serialized,compressed data over a tcp connection using protobuf-net and
GzipStream

The deserializing or reading from the zipstream just blocks and does not complete.

To test it I opted to try using a simpler FileStream to see that the data was actually being compressed and written, which it was.
However the line Console.writeLine(inPerson1.name) throws a Object reference not set exception since it seems to be not reading any data from the zipstream.

Any thoughts on why, or what I am doing wrong?

Code:

public void TestZipToFile(){
  var person1 = new Person { id = 1, name = "Pete" };
  var person2 = new Person { id = 2, name = "Sarah" };
  using (var file = File.Create("people.bin"))
  {
    GZipStream zs = new GZipStream(file, CompressionMode.Compress);
    Serializer.SerializeWithLengthPrefix<Person>(zs, person1, PrefixStyle.Fixed32);//.Serialize(file, foo);
    Serializer.SerializeWithLengthPrefix<Person>(zs, person2, PrefixStyle.Fixed32);//.Serialize(file, foo);
  }
  Person inPerson1 = null;
  Person inPerson2 = null;
  using (var file = File.OpenRead("people.bin"))
  {
    GZipStream ozs = new GZipStream(file, CompressionMode.Decompress);
    inPerson1 = Serializer.DeserializeWithLengthPrefix<Person>(ozs,PrefixStyle.Fixed32);//.Deserialize<Foo>(file);
    inPerson2 = Serializer.DeserializeWithLengthPrefix<Person>(ozs, PrefixStyle.Fixed32);//.Deserialize<Foo>(file);
  }
  Console.WriteLine(inPerson1.name);
  Console.WriteLine(inPerson2.name);
}

[ProtoContract]
public class Person
{
  [ProtoMember(1)
  public int id;
  [ProtoMember(2)]
  public string name;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T21:33:12+00:00Added an answer on June 6, 2026 at 9:33 pm

    You’re never closing the output GZipStream, so I suspect it ends up never writing anything to the underlying stream. You should have a using statement for each GZipStream as well as the FileStream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to send a serialized object over a TCP connection as
I'm trying to send a lot of data from a form using the $.post
I am trying to send email using Exchange 2007 from a console app using
I am trying to send a serialized object using JSON. Here is my view
I am trying to send a serialized Java object from a client to a
Actually I am trying to send data from jQuery to Spring controller and in
I'm trying to send an object from my ASP .NET C# MVC3 project to
I am trying to send data as a model from an html form to
I am trying to send a serialized object from a server process to a
I'm trying to send messages (byte arrays) from Node.js to Java via TCP socket

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.