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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:51:10+00:00 2026-06-17T08:51:10+00:00

I have a small server-client application that doesn’t do very much (a client connects

  • 0

I have a small server-client application that doesn’t do very much (a client connects to the server, sends a number trough a pipe and receives another number).

But it only works with one connection at a time (While a client is connected, no other client has access to the server)

I want to make it possible for multiple clients to connect to the server at one time, and I plan to do this with worker threads.

Obs:

#define CONNECT_NAMEDPIPE "\\\\.\\pipe\\ClientToServer"

Server:

HANDLE namedPipe = CreateNamedPipe (CONNECT_NAMEDPIPE, 
                                    PIPE_ACCESS_DUPLEX,
                                    PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
                                    2,
                                    sizeof(MinMax),
                                    sizeof(NumberList),
                                    0,                  // timeout
                                    NULL);

if (namedPipe == INVALID_HANDLE_VALUE) {
    printf("Unable to create named pipe\r\nServer closing\r\n");
    printf("CreateNamedPipe failed, GLE=%d.\r\n", GetLastError());
} // Error unable create pipe
else {
    printf("Server created\r\n");
    printf("Awaiting connection\r\n");

    ConnectNamedPipe(namedPipe, NULL);
    etc ...
}

So the server waits on ConnectNamedPipe until a client connects, then is unavailable for any other connections.

If I’d like to enable multiple connections, how should I create the worker threads ?

Should every connection attempt create a new pipe (with a new pipe name / path – CONNECT_NAMEDPIPE can’t be used for all)

How do I know when someone else is trying to connect ? Where should my threads be ? I’m stuck.

  • 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-17T08:51:11+00:00Added an answer on June 17, 2026 at 8:51 am

    I think Berkeley sockets are better suited for this. If you must go with pipes, something like this could work:

    1. The client sends a connection request through the main named pipe to the control thread.
    2. The server creates (or fetches from a pool) a worker thread that listens on another, unique pipe.
    3. The control thread answers with the name of this new pipe.
    4. The client closes the control pipe and sends real request data to the new pipe.
    5. The worker thread reads the request, processes it, and sends back the response.
    6. Meanwhile the control thread is ready to read another connection request from another client.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small client/server application, written in C, that needs to authenticate with
I have a small application which doesn't seem to work. Please help. Server: var
I have a server application that needs to find and exchange small amounts of
I have written a small client server socket application. It is a proof of
Is there anyway to have a client side small database that syncs with server
I have to create a small .NET client application that will be using Exchange
I implemented a small client server application in Ruby and I have the following
I have a client/server application that depends on MS SQL database for backend storage,
I am developing a small web application. I have pretty much finished the server
I have a python script running on a small server that is called in

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.