473,748 Members | 4,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1809
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.pro gramming
might be a good place to start.
Nov 14 '05 #2
In article <11************ **********@o13g 2000cwo.googleg roups.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
"exceptiona l 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.nr c-cnrc.gc.ca (Walter Roberson) writes:
In article <11************ **********@o13g 2000cwo.googleg roups.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_Keit h) 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**********@c anopus.cc.umani toba.ca>, ro******@ibd.nr c-cnrc.gc.ca (Walter Roberson) writes:

If your OS considers the closing of a socket to be an
"exceptiona l 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
2732
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 tables, and make a new table consisting of only those two fields. That's for normalization purposes, to resolve a many-to-many situation. Anyway, I have three dropdowns, which I intentionally gave the same name. I want people to select one, two, or...
4
2168
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 create a socket, bind it to a port, put it in listen mode, and then n sockets can connect to it. The code: Socket newSocket = listeningSocket.Accept(); returns a socket. I can communicate on newSocket, and listeningSocket goes
20
7516
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, but this seems to rely on a call from the application, e.g. MyClass.Dispose()
2
1817
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 unhandled expection in disassembly code: "Connection was forcidbly closed by remote host" stack trace:
21
18176
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. This has been fine until last week when I started getting javascript 'Permission Denied' errors when I try to access this property. I suspect that a windows update has caused this somehow, as this code has not changed for a very long time. Can...
22
4032
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 receive 5 bytes buffer , I call the BeginReceive and then wait on AsyncWaitHandle.WaitOne() but it is signald imidiatly , and the next call to EndReceive return zero bytes length , also the buffer is empty. here is the code: public static byte...
22
12486
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=" & msDbFilename moConn.Properties("Persist Security Info") = False moConn.ConnectionString = msConnString moConn.CursorLocation = adUseClient moConn.Mode = adModeReadWrite' or using default...same result
6
15607
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 but it seems a little poor to me. :-\ Is there a reliable way to test such socket 'state'?
0
8823
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.