473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

When using select call on many sockets, how to check if one of them is closed

I am using the select call to read from many sockets. I don't want to
call read on every socket to check if it is closed, as it defeats the
purpose of using the select call.
Is there any way to know whether one of the sockets have been closed,
without actually testing each socket.

Nov 14 '05 #1
4 1789
pr***************@gmail.com wrote:
I am using the select call to read from many sockets. I don't want to
call read on every socket to check if it is closed, as it defeats the
purpose of using the select call.
Is there any way to know whether one of the sockets have been closed,
without actually testing each socket.


C doesn't know what a socket is. Check a newsgroup or forum that deals
with whatever networking library you're using. alt.winsock.programming
might be a good place to start.
Nov 14 '05 #2
In article <11**********************@o13g2000cwo.googlegroups .com>,
pr***************@gmail.com <pr***************@gmail.com> wrote:
I am using the select call to read from many sockets. I don't want to
call read on every socket to check if it is closed, as it defeats the
purpose of using the select call.
Is there any way to know whether one of the sockets have been closed,
without actually testing each socket.


select() is not one of the routines defined by the C standards.
It is therefore not generally considered to be on-topic here.

We wouldn't be able to answer your question without knowing
the operating system (and version) .

If your OS considers the closing of a socket to be an
"exceptional condition" then you may be able to examine the
exception bitset and check only the fds marked as being in exception.
Some would argue, though, that close is a normal condition, not
an exceptional one (exceptional might be things like a TCP RST
or a pipe closing), so you would need to check the details
for whichever operating system you happen to be using (which you
have left us to guess...)
--
Are we *there* yet??
Nov 14 '05 #3
ro******@ibd.nrc-cnrc.gc.ca (Walter Roberson) writes:
In article <11**********************@o13g2000cwo.googlegroups .com>,
pr***************@gmail.com <pr***************@gmail.com> wrote:
I am using the select call to read from many sockets. I don't want to
call read on every socket to check if it is closed, as it defeats the
purpose of using the select call.
Is there any way to know whether one of the sockets have been closed,
without actually testing each socket.


select() is not one of the routines defined by the C standards.
It is therefore not generally considered to be on-topic here.

We wouldn't be able to answer your question without knowing
the operating system (and version) .


Correction: Even if we know what operating system you're using, the
best we can do is tell you which newsgroup can help you.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #4

In article <d4**********@canopus.cc.umanitoba.ca>, ro******@ibd.nrc-cnrc.gc.ca (Walter Roberson) writes:

If your OS considers the closing of a socket to be an
"exceptional condition" then


.... it follows neither the POSIX nor Winsock standards, so the OP
would *definitely* need a platform-specific group.

If, on the other hand, the OP's implementation of sockets does follow
either of those standards, he could find help at comp.protocols.tcp-ip,
as well as at platform-specific groups. (Or, for that matter, in any
of a great number of resources, such as FAQs and books, both of which
should be consulted by anyone trying to use any of the sockets APIs.)

And that, once again, is why we shouldn't try to answer off-topic
questions here.
--
Michael Wojcik mi************@microfocus.com

A coding theorist is someone who doesn't think Alice is crazy. -- John Gordon
Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: middletree | last post by:
Posted this to Access group, meant to do it here: I have what I call a composite table. Can't recall what they called it in database class, but it's where you take the PK of two different...
4
by: 0to60 | last post by:
I have a question about socket programming in general. Exactly what happens behind the scenes when I one socket connects to a different socket in listen mode? Using the dotnet framework, I...
20
by: Charles Law | last post by:
I have an application that creates a class. The class has unmanaged resources, so must end gracefully. How can I guarantee that the unmanaged resources are freed? I have looked at IDisposable,...
2
by: Robbert van Geldrop | last post by:
Hello, I have a client that consumes a WebService using a WSE 2.0 sp3 interface. I use a WebProxy as generated by VS.Net, based on a webService URL. Occasionaly when debugging I get an...
21
by: alistair_henderson | last post by:
Morning All, I have some code for a website which uses 'window.open' to simulate modal dialog boxes. I use the window.closed property to decide if the window object exists at various points. ...
22
by: semedao | last post by:
Hi , I am using asyc sockets p2p connection between 2 clients. when I debug step by step the both sides , i'ts work ok. when I run it , in somepoint (same location in the code) when I want to...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
6
by: billiejoex | last post by:
Hi there. I'm setting up test suite for a project of mine. situations, if the socket is closed on the other end or not. I noticed that I can "detect" such state if a call to socket.read() returns...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.