Re: How Can I call close() for all
- From: Joe Pfeiffer <pfeiffer@xxxxxxxxxxx>
- Date: 27 Nov 2007 09:15:20 -0700
sreyas.jose@xxxxxxxxx writes:
I have a server application that uses a communication loop
with a select to handle multiple clients.
How Can I call close() for all
the sockets currently open? (i.e., all the clients currently
connected) Will that cause any sort of trouble?
Not for the system. Whether it causes trouble for the clients depends
on the clients...
What I want/need to do is to implement a mechanism to
shutdown the server, so I'm wondering if I can just go
through the list of the sockets and close them (well,
maybe sending them a message first).
If all you want to do is make sure they're all closed, you can just
stop your server. All open file descriptors are closed while a
process is shutting down.
If you want to send a message first, you can just go through all the
file descriptors that have clients connected and send it. Presumably
you're keeping track of them.
.
- References:
- How Can I call close() for all
- From: sreyas . jose
- How Can I call close() for all
- Prev by Date: kernel module unresolved symbol
- Next by Date: Re: How Can I call close() for all
- Previous by thread: Re: How Can I call close() for all
- Next by thread: how to access the keyboard ps/2 port directly?
- Index(es):
Relevant Pages
|
|