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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:19:04+00:00 2026-05-22T21:19:04+00:00

I am new to network programming so I have a question: is it safe

  • 0

I am new to network programming so I have a question: is it safe to send an integer (let’s assume 16 bit integer because 32 has issue with “endianess”) in my case between C++ and C# and how do that?

In my program I cast int to char (I know is is lower than 255) and send it. However, I would like to send 32 int. I tried conduct that with protocol buffers. I used WriteVarint32 in C++ and ProtoReader.ReadUInt32 in C# with no success (exception in C#). I thought it will work after I read this.

Would you be so kind and suggest me the right way to send an integer between C++ and C# applications? If you explained me how to do that with protocol buffers (protobuf-net in case of C#), I would be very pleased.

  • 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-22T21:19:04+00:00Added an answer on May 22, 2026 at 9:19 pm

    If you are writing with protobuf-net, the WithLengthPrefix methods will do this for you. I’d be more than happy to help with this (I’m the author). Btw, the reason it is throwing an exception is that a varint value by itself is not normally valid in a protobuf stream. The system will override this in the case of WithLengthPrefix if you pass 0 as the field number (or pass a positive field-number for a more pure protobuf stream; this is optional, though).

    As it happens there is a method on ProtoReader to read an isolated varint (without worrying about protobuf stream semantics) it would be trivial for me to add such to ProtoWriter if that would be useful.

    Btw – in terms of PrefixStyle, Base128 is the same as varint. Some folks prefer 32-bit prefixes, to marry up with other systems – hence a few others are provided.

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

Sidebar

Related Questions

I am new to network programming, and have been learning this by writing small
I am new to C++ network programming but have experience with Java sockets etc.
So, I'm pretty new to all this network programming, and I have a few
This is a continuation of the this question. I am new to network programming,
I am new to network programming but old to Python. I have a simple
Firstly, I'm relatively new to network programming. I want to intercept and delay HTTP
Let me state up front, that sockets programming is fairly new to me. Also,
I know this isn't strictly a programming question but y'all must have experienced this.
I am working on a network programming and I have created a thread pool.
I am a college student slightly new to web programming and lately I have

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.