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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:10:49+00:00 2026-05-12T10:10:49+00:00

How can I protect against fragmented messages being sent through a named pipe. Is

  • 0

How can I protect against fragmented messages being sent through a named pipe. Is it as simple as a while loop checking for an error or disconnect…. or is there more to it?
(using winapi, named pipes in C)

Thanks.

  • 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-12T10:10:50+00:00Added an answer on May 12, 2026 at 10:10 am

    There are two factors that affect whether messages can be fragmented:

    1. Message length
    2. Read length

    You must write the message atomically – a single write for the whole message.

    If the message is longer than the pipe buffer size (which need not be very big), then your message will be fragmented into a sequence of bits. The first will fill up the buffer, the next few will be the buffer size, and the last will be whatever is left over.

    You must read the message atomically too. That is, your read must be big enough to get the whole message in one go. If you have a single reader process (or thread), then you probably can read, say, a 2-byte length from the start of the message and then read the rest of the data atomically. (A 4-byte length would be overkill; the maximum buffer size is normally in the 512-5120 sort of range, though it does vary by system.)

    Complications include the fact that if there are multiple processes that can write on the pipe, then other processes may manage to interleave their data into the pipe while your oversize message is being sent.

    Strictly, this applies to Unix-based systems. However, my understanding is that the WinAPI closely reflects Unix in this area.

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

Sidebar

Related Questions

Possible Duplicate: Can I protect against SQL Injection by escaping single-quote and surrounding user
Is checking the referrer enough to protect against a cross site request forgery attack?
How can I protect my web server, if I run custom users code on
May be a stupid questions but can I protect a row of data in
To my knowledge Nginx can only password protect directories from within the configuration file(s).
i search online but can't get satisfactory result i want to protect images on
I'm creating a simple CMS using kohana3 in which user can add project to
Adding the X-Frame-Options DENY to the response header helps protect against malicious framing of
I've been looking at how best to protect against sql injection in PHP/mysql beyond
I have a large link database, that I would want to protect against others

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.