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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:45:44+00:00 2026-06-09T12:45:44+00:00

Suppose I have a server application – the connection is over TCP, using UNIX

  • 0

Suppose I have a server application – the connection is over TCP, using UNIX sockets.

The connection is asynchronous – in other words, clients’ and servers’ sockets are non-blocking.

Suppose the following situation: in some conditions, the server may decide to send some data to a connected client and immediately close the connection: using shutdown with SHUT_RDWR.

So, my question is – is it guaranteed, that when the client call recv, it will receive the (sent by the server) data?

Or, to receive the data, recv must be called before the server’s shutdown? If so, what should I do (or, to be more precise, how should I do this), to make sure, that the data is received by the client?

  • 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-09T12:45:46+00:00Added an answer on June 9, 2026 at 12:45 pm

    You can control this behavior with “setsockopt(SO_LINGER)”:

    • man setsockopt

    SO_LINGER
    Waits to complete the close function if data is present. When this option is enabled and there is unsent data present when the close
    function is called, the calling application is blocked during the
    close function until the data is transmitted or the connection has
    timed out. The close function returns without blocking the caller.
    This option has meaning only for stream sockets.

    See also:

    • man read

    • Beej’s Guide to Network Programming

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

Sidebar

Related Questions

Suppose I have an application that access data resident in a central DB server
Suppose that i have an application that connects to a sql server, and this
Suppose we have an application (on a server) that has a set of resources:
Suppose you have a client/server application, say a webserver component and a qt gui.
I have 2 application deployed on my server and first application is suppose to
Suppose we have client-server application, compiling by one makefile. Server uses libtask for parallel
In our application we have a server which will connect to multiple clients. For
Suppose I have a wcf service listening on a remote server. Could a client,
Suppose I have static ip in a subnet that has DHCP server. If i
Suppose I have a event handler which makes two AJAX calls to the 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.