Robust Server using Sockets

  • Thread starter Thread starter Nash
  • Start date Start date
N

Nash

Hi,
I want to develop a server application which can handle 1 million
clients. I plan to use asynchronous tcp/ip sockets to handle clients.
The communication is not frequent and the data transfered is also
less(Max 100kb packet)

I have some ideas to implement it

1. To have a single server which will service all the 1 million
clients. Server will listen to the connections on a particular port
and once connected will keep the connection open forever.

2. To have a single server which will service all the 1 million
clients. Server will send data in one port and receive data in other
port. Once data is sent the connection will be closed.

3. To have a distributed servers where a tree structure is maintained
and all the clients connected to the bottom most layer.

I would like to know how many socket connections can be kept open in
windows operating system.

Please help me to identify the correct design
approach.



thanks,
regards,
Jeevanand
 
Nash said:
Hi,
I want to develop a server application which can handle 1 million
clients. I plan to use asynchronous tcp/ip sockets to handle clients.
The communication is not frequent and the data transfered is also
less(Max 100kb packet)

I have some ideas to implement it

1. To have a single server which will service all the 1 million
clients. Server will listen to the connections on a particular port
and once connected will keep the connection open forever.

2. To have a single server which will service all the 1 million
clients. Server will send data in one port and receive data in other
port. Once data is sent the connection will be closed.

3. To have a distributed servers where a tree structure is maintained
and all the clients connected to the bottom most layer.

I would like to know how many socket connections can be kept open in
windows operating system.

Please help me to identify the correct design
approach.



thanks,
regards,
Jeevanand

1 Million connection! That's too much....But I suppose not all will
connect at a time.

Windows XP SP2 had limited the number of simultaneous TCP connection to
10. You should be using a server grade OS

The server application can listen on a fixed port say 5000. When a
client connects to the server, the server will receive the connection
request and will create a new socket (this is done automatically) and
will communicate with this new client using the new socket. It won't use
the initial (server) socket for communicating with the client. The
server application will continue to listen on port 5000 for new clients.
This port will be used only for the clients to connect to the server. No
data will be sent or received on this port/endpoint.

After a client has connected to you server application, you can then
initiate a new connection to the client if you want to have 2 different
sockets for 2 way communication.

Keeping the connection forever ??? why?? You will end up eating all the
system resources!! You must use a better design.
 
Read comments inline:

I hardly believe any of Windows Operating System will be able to keep 1
million of opened TCP sockets (even server editions) even in 2008 year. Each
socket occupies some memory, so your machine can simply went out of memory.

Not sure I understand this correctly. Server is a server, it has to listen
for clients. What kind of data does it send? Where does it send it? To
client? In this case client becomes not a client but a server :)

Sounds better.
 
Windows XP SP2 had limited the number of simultaneous TCP connection to
10. You should be using a server grade OS

Have you tested this, or do you have a URL to a good source that confirms
the above ?

I know XP limits the number of *uncompleted* TCP connections (SYN sent but
no ACK received yet).

I've heard that XP lmitis the number of connections to shared files or
printers.

But I've not come across the limit of 10 TCP connections that you mention.

Dave.
 
Have you tested this, or do you have a URL to a good source that confirms
the above ?

I know XP limits the number of *uncompleted* TCP connections (SYN sent but
no ACK received yet).

I've heard that XP lmitis the number of connections to shared files or
printers.

But I've not come across the limit of 10 TCP connections that you mention..

Dave.

You are correct. This is an often-repeated myth.

Rumor is that at one time (well before XP, I think) Microsoft was
going to do this (on Windows 2000 non-server maybe). A company that
felt the behavior was absurd had developed a drop-in replacement TCP/
IP stack that didn't have this limitation, and Microsoft relented. I
have no idea if this is true or false.

DS
 
Ashutosh Bhawasinka said:
1 Million connection! That's too much....But I suppose not all will
connect at a time.

Certainly if you count _just_ the amount of memory you'll take up servicing
that many client connections, you can see that this is essentially
impossible for anything less than a seriously parallel server architecture.
Windows XP SP2 had limited the number of simultaneous TCP connection to
10. You should be using a server grade OS

No - Windows XP SP2 limited the number of simultaneous _half-open_
_outgoing_ connections to 10.

There's a HUGE difference.
The server application can listen on a fixed port say 5000. When a client
connects to the server, the server will receive the connection request and
will create a new socket (this is done automatically) and will communicate
with this new client using the new socket. It won't use the initial
(server) socket for communicating with the client. The server application
will continue to listen on port 5000 for new clients. This port will be
used only for the clients to connect to the server. No data will be sent
or received on this port/endpoint.

This is wrong. A TCP server listening on port 5000 will accept connections
on port 5000, and those connections will _stay_ on port 5000. You will not
see a different port. That doesn't mean that you won't see a new endpoint
for each connection.
After a client has connected to you server application, you can then
initiate a new connection to the client if you want to have 2 different
sockets for 2 way communication.

No, that's not necessary either. Socket communication in TCP and unicast UDP
is two-way. Only multicast / broadcast is one-way.
Keeping the connection forever ??? why?? You will end up eating all the
system resources!! You must use a better design.

I think this person must use a training course or book to learn how to
design and program network code - there are _way_ too many crappy network
programs out there, and he's just going to add one more, trying to learn it
piecemeal through newsgroup postings.

Alun.
~~~~
 
Back
Top