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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:23:40+00:00 2026-05-12T21:23:40+00:00

Hi i have a couple of question about using named pipes. Firstly, when trying

  • 0

Hi i have a couple of question about using named pipes.

Firstly, when trying to setup a pipe server, i have noticed that if i use the code below.. at the end of the first client connect the server becomes unavailable UNLESS i wrap the whole thing in a while (true) block. Have i done this correct? or is each server only supposed to be active once and then die?

using (NamedPipeServerStream pipeServerStream = new NamedPipeServerStream(pipeName, PipeDirection.In, 1, transmissionMode))
{
    pipeServerStream.WaitForConnection();

    using (StreamReader sr = new StreamReader(pipeServerStream))
    {
        string message = null;

        do
        {
            message = sr.ReadLine();
            OnPipeCommunicationHandler(new IPCData() { Data = message });
        }
        while (message != null);
    }
} 

Secondly, i have also had to spin off the server on its own thread – If i dont do this my application wont become available. Is this normal? have i done this correctly? I thought i read somewhere that under the hood the namedpipeserverstream creates its own thread for itself but i cant see that that is the case..

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-12T21:23:40+00:00Added an answer on May 12, 2026 at 9:23 pm

    Yes, for named pipes you need to create a new instance of the server for the next client to be able to connect. What is normally done (in synchronous programming at least) is you wait for a connection then spawn a new thread to handle the client, with the original thread looping back to create a new server.

    As for threading, well even if the object creates a thread behind the scenes (which I doubt) it doesn’t get around the fact that the code you have written is synchronous and thus would need to be in its own thread anyway.

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

Sidebar

Related Questions

I have a table that is currently using a couple of columns named DateFrom
I have a couple of questions about using databases with Jquery Mobile. When you
I have questions about a couple techniques I'm using in designing a class. I've
I have a question about inheritance in Entity Framework 4. We are using a
I am new to C programming, and have a question about the following couple
I have a similar question out there about VC containment that addresses my desired
I asked a question a couple weeks ago about using setTimeout for a factorial
I'm about to start using location services, but have a general question about how
Background I have a couple of projects that use a SQLite DB for data.
I'm trying to teach myself about OOP in C#, but I have a question

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.