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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:57:21+00:00 2026-05-22T20:57:21+00:00

I am writing a network C program where a client sends a block of

  • 0

I am writing a network C program where a client sends a block of data to a server, and I want
to make sure that all data have been read by the server before I close the socket from the client side. I thought of sending a special ‘ok’ character back from the server to the client, but I am thinking that if something wrong happens during the execution of the server
program and the server closes the pipe from his side (e.g. read system call fails), the client is going to wait on a read system call for something that will never come. Any idea about how I can solve this?

thanks,
Nikos

  • 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-22T20:57:22+00:00Added an answer on May 22, 2026 at 8:57 pm

    I want to make sure that all data have
    been read by the server b*efore I close
    the socket from the client side
    *.

    If you are using TCP consider this: once you send the data, even if you close the socket / exit the program, the TCP stack will continue to do its best to send it.

    Once you send / write the data, it’s gone from your hands. It’s copied in a kernel buffer and sent some time later. Behind the scenes (somewhere deep in netinet) the connection is not closeduntil all sent data has been acknowledged / the connection is terminated due to other reasons.

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

Sidebar

Related Questions

I am writing an application that needs to send data over a network. I
I am writing a simple C# tcp client and server program. The server will
I'm writing a simple program to browse the local network and pass on filenames
I'm looking into writing a wxWidget that displays a graphical node network, and therefore
I'm writing a simple console client-server app using MSMQ. I'm attempting to run it
Purpose I am writing a network program in C (specifically gnu89 ) and I
I'm writing a network app, where each Client has a Singleton ClientManager. For testing
I am testing my socket programs at home, in local network. Server and client
We have a program, written in C, that uses RPC to communicate with another
Right now i'm writing an iPhone app that will interact with a network, and

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.