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

  • SEARCH
  • Home
  • 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 8545717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:51:25+00:00 2026-06-11T12:51:25+00:00

I have created an application where interprocess communication is done using sockets. The procedure

  • 0

I have created an application where interprocess communication is done using sockets. The procedure starts when a client connects with the server that I created and sends a serialized message. This message, I serialize using Protobuf-net, using SerializeWithLengthPrefix and deserialize it using DeserializeWithLengthPrefix. The client sends messages to the server who deserializes it perfectly, but the same is not true in the case of server to client.

The main class is BaseMessage, which is abstract.

[Serializable, ProtoContract, ProtoInclude(5001, typeof(LogonMessage))]
abstract public class BaseMessage
{
    public BaseMessage()
    {

    }

    abstract public int MessageType { get; }
}

And LogonMessage implements the BaseMessage Class.

[Serializable, ProtoContract]
public class LogonMessage : BaseMessage
{
    public LogonMessage()
    {

    }

    [ProtoMember(1)]
    public string Broker { get; set; }

    [ProtoMember(2)]
    public int ClientType { get; set; }

    public override int MessageType
    {
        get { return 1; }
    }
}

After the initial handshake, the client requests some service serialized with the help of protobuf-net and the local server at my end serves it by requesting data from another server on the web. This message transfer from the client to the server is done flawlessly.

When my server receives the data from the web server, it serializes it and sends the data to the client. But this time, when I try to deserialize the data on the client-side using the same procedure, I get the following exception:
“No parameterless Constructor found for BaseMessage”

I deserialize using the following line of code(this is where the exception occurs).

BaseMessage baseMessage = Serializer.DeserializeWithLengthPrefix<BaseMessage>(networkStream, PrefixStyle.Base128);

And this is how the message was serialized on the server.

Serializer.SerializeWithLengthPrefix(networkStream, baseMessage, PrefixStyle.Base128);

The NetworkStream used at the start of the connection between the client and server is stored in an object and that object is stored in a dictionary. I pick out the same NetworkStream from that object in the dictionary and use it to send serialized data to the client(from the server). But the above mentioned problem occurs. Any help?

Thanks in advance…

  • 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-11T12:51:26+00:00Added an answer on June 11, 2026 at 12:51 pm

    That should work fine in any v2 release; 2.0.0.480 is the currently advertised download on NuGet, but 2.0.0.580 is also available. I’ve checked both 1.0.0.280 and 2.0.0.480, and neither of them show this symptom, so I’m guessing you’re using a different build. My advice, therefore, is: make sure you’re on one of those two (or higher, where available).

    For info, you don’t need [Serializable] for protobuf-net, but it doesn’t hurt either. Also, your BaseMessage constructor should probably be protected (public doesn’t really make sense on the constructor of an abstract type). But since the compiler does all that for you automatically, you can simplify:

    [ProtoContract, ProtoInclude(5001, typeof(LogonMessage))]
    abstract public class BaseMessage
    {
        abstract public int MessageType { get; }
    }
    
    
    [ProtoContract]
    public class LogonMessage : BaseMessage
    {
        [ProtoMember(1)]
        public string Broker { get; set; }
    
        [ProtoMember(2)]
        public int ClientType { get; set; }
    
        public override int MessageType
        {
            get { return 1; }
        }
    }
    

    Other thoughts: 5001 is a bit on the high-side; you will get better efficiency from low-value include-numbers. 1 leaps to mind. They don’t have to be universally unique: just unique inside that type.

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

Sidebar

Related Questions

I have created an application that connect on a web-server and reads an xml
I have created application which is accessing alfresco using web service client. Now I
I have created a application for using the libtorrent. In that I am using
I have created server application that has to process some data (that is quite
I have created an application using Netbeans 6.9. In the application I want that
I have created an application which has a client (WPF) and the Server (WCF),
I have created an application that has a Login. It starts with a Welcome
I have created an application using Adobe Flex. I took all the files from
I have created an application that uses settings.settings to store some user specific settings
i have created application using layout font sizes in pixels font and other layout

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.