Re: client-server application question
- From: "azsx" <radu_plugaru@xxxxxxxxx>
- Date: 17 Nov 2006 11:36:53 -0800
Presumably your server already stores a list of connected
clients, at the very least that's the list of sockets it maintains.
If it doesn't you should change it so it does. You can use
getpeername to get the IP addres and port number of the
peer (client) for each socket.
Every thread i create when a new client arrives adds a new entry in a
map object.
As far as how many of these are alive - you can't get awayThis means that from time to time I should send data and wait for a
from active keep-alive pinging, since a TCP connection
with no data flowing can silently break at any time with
no indication for either peer until attempted data transmission
fails.
responce? I thought of that, but what if the connection speed with some
clients is small? Wouldn't that affect my process? How much time sould
I wait for an answer from the client? If I wait for all clients
responces and some client doesn't answer?
As for your design with a thread per client - this is very
inefficient for a client, but it is a pure disaster for a server.
Learn about the other socket models offered by WinSock.
For a server the ultimate model is overlapped I/O using
I/O Completion Port (IOCP).
How can I find out more about that? Please give me some links!
.
- Follow-Ups:
- Re: client-server application question
- From: Alexander Nickolov
- Re: client-server application question
- From: Arkady Frenkel
- Re: client-server application question
- References:
- client-server application question
- From: azsx
- Re: client-server application question
- From: Alexander Nickolov
- client-server application question
- Prev by Date: Re: IMimeInternational::DecodeHeader method
- Next by Date: Re: Database Server based on SQL database
- Previous by thread: Re: client-server application question
- Next by thread: Re: client-server application question
- Index(es):
Relevant Pages
|