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 7434257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:48:22+00:00 2026-05-29T09:48:22+00:00

What I am doing is attempting to send an IPEndpoint through protobuf-net and what

  • 0

What I am doing is attempting to send an IPEndpoint through protobuf-net and what I observed is that when deserializing the array of 4 bytes into the IP4 address, the set code recieves a value of 8 bytes. Four bytes containing the orignal address, and 4 more bytes containing the address that was serialized. By stepping through the code I have been able to confirm that when Deserialize is called, it first reads the bytes, and then sets they bytes.

After doing some reading I learned about OverwriteList, and as can been seen in the example below, I have set that to true. However the setter is still provided an 8 byte value.

Does anyone have a clue what I am doing wrong?

This sample code should throw an exception when used with protobuf-net r480, Visual Studio 2010 as a .Net 4.0 console application.

using ProtoBuf;
using System.Net;
using System.IO;

namespace ConsoleApplication1
{

    [ProtoContract]
    class AddressOWner
    {
        private IPEndPoint endpoint;

        public AddressOWner() 
        { endpoint = new IPEndPoint(new IPAddress(new byte[] {8,8,8,8}), 0); }

        public AddressOWner(IPEndPoint newendpoint)
        { this.endpoint = newendpoint; }

        [ProtoMember(1, OverwriteList=true)]
        public byte[] AddressBytes
        {
            get { return endpoint.Address.GetAddressBytes(); }
            set { endpoint.Address = new IPAddress(value); }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            AddressOWner ao = new AddressOWner(new IPEndPoint(new IPAddress(new byte[] { 192, 168, 1, 1 }), 80));

            MemoryStream ms = new MemoryStream();
            Serializer.Serialize(ms, ao);
            byte[] messageData = ms.GetBuffer();
            ms = new MemoryStream(messageData);
            AddressOWner aoCopy = Serializer.Deserialize<AddressOWner>(ms);
        }
    }
}
  • 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-05-29T09:48:24+00:00Added an answer on May 29, 2026 at 9:48 am

    It looks like this is actually a bug, specific to byte[], which is handled as a particular protobuf primitive. Other arrays/lists are mapped to repeated (in protobuf terms), and handle the OverwriteList option correctly. I will tweak the byte[] handling to support this option.

    Edit: this is fixed in r484, with supporting integration test

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

Sidebar

Related Questions

I am attempting to send a javascript array to my web server for an
Error tells me that No '-setRosterForBoat:' method found. What I am doing is attempting
I understand that doing what I'm attempting is very bad programming form (relying on
I am attempting to shuffle an array, but the way I am doing it
Could somebody explain what I'm doing wrong in attempting to insert a new UITableViewCell?
I am attempting to paginate a shuffled ActiveRecord query. The syntax for doing this
Doing my first SL4 MVVM RIA based application and i ran into the following
I'm attempting to write a Python function to send an email to a list
I have a problem when attempting to serialize class on a server, send it
Doing a project in win32 in c++, attempting to double buffer the image being

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.