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

  • Home
  • SEARCH
  • 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 8822845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:12:30+00:00 2026-06-14T06:12:30+00:00

I wrote a simple server-client program in which server and client are communicating using

  • 0

I wrote a simple server-client program in which server and client are communicating using named pipes.Everything is working fine,but i have a simple question:
In the client part i allocate the msg that is going to be sent to the server in this way char *msg=malloc(sizeof(char)); and then i use gets(msg) to read it from user.At the end iam writting the message to the pipe with the write() function.
In the server part now,i also allocate the buffer with malloc,but i dont know what the 3rd argument of the read() function should be…As i can undestand from the man page read’s 3rd argument is the number of bytes you want to read and i assume that this is the strlen of the msg that the client is sending.The problem is that prior to read iam not able to know this.Is there a way to make this work or i should essentially use a MAX_SIZE for the buffer in server part.
Thank you in advance for your time and your help.:)

  • 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-14T06:12:32+00:00Added an answer on June 14, 2026 at 6:12 am

    The only possible solution is this mentioned from onon15 in the comment above.”send the length of the buffer to expect, before sending the buffer”.

    Iam writting this as an answer to mark the question answered.

    Thanks onon15!

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

Sidebar

Related Questions

I'm trying to write a simple server-client program, but I have a problem: I
I wrote two simple programs server and a client using sockets in C++ (Linux).
I have a simple programs for socket client and server its not working over
So I wrote a simple Socket program that send message from Client to Server
I'm implementing a simple client-server program. Some parts of the i wrote is: int
I wrote a simple server client socket program and when I recompile the server
I wrote an XML RPC server in python and a simple Test Client for
I'm writing a simple console client-server app using MSMQ. I'm attempting to run it
I'm exploring MSMQ services, and I wrote a simple console client-server application that sends
I wrote a plain simple java program to perform remote connection with HornetQ server.

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.