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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:11:45+00:00 2026-06-06T07:11:45+00:00

I am writing some kind of server application (in C++), which holds an fd_set

  • 0

I am writing some kind of server application (in C++), which holds an fd_set of file descriptors of sockets the server is communicating with, and I wish to know when one of them is closed\shut down on the other side without having to read\write to it. I routinely block on select() (with no time out), waiting for read readiness and exceptional conditions of the two fd_set I supply it with.

I started out thinking that any socket being closed on the other side would appear in the exceptfds, but as I read on I came to understand that it is not necessarily the case. The select() man page does not really say much about what exceptions exceptfds is being watched for. Further more, to my understanding what is considered as an exceptional condition changes from OS to OS (I myself am using Ubnubt 11.10), and I have not found anywhere a reference to a socket being closed\shut down (on the other side) as an exception.

Also, the socket(7) man page mentions two kinds of signals that a socket may send:

  1. SIGPIPE – Is sent when writing into a shut down socket.
  2. SIGIO – Is sent when an I/O event occurs.

Unfortunately, it is not mentioned what constitutes as an I/O event, and anyway shutting down might not be considered as an I/O event by everyone (I myself am a good example).

So what I’m asking is – Can I make a socket either send a signal or insert itself into exceptfds when it is closed, or to actively prompt me in some other way?

Thanks,
Shay

  • 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-06T07:11:48+00:00Added an answer on June 6, 2026 at 7:11 am

    Usually, when a socket is closed by the remote peer, it becomes readable (for the purposes of select()), and when you read from it you get zero bytes back. This zero byte read indicates that the other end closed the socket normally. This is not considered an exceptional condition.

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

Sidebar

Related Questions

I am writing a server-client application. I have a server that holds several sockets
i'm writing some kind of application that will send http requests to server. My
I'm currently writing an iPhone application which gets some data from the user and
i am writing a client/server application. Now i want to do some basic diagrams
I am writing an enterprise client/server application. The client is an iOS app which
I am writing some kind of IPC functionality and need to pass certain resources
I have some Delphi 2007 code which runs in two different applications, one is
I'm writing an application that has POCO Entity Framework data access on the server.
I'm writing an application which aims to centralize all data related to project management
I am writing event based android application in which I start main thread which

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.