Re: Sockets application with 200 clients

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Parahat Melayev (parahat_at_momenttech.com)
Date: 02/03/05


Date: Thu, 3 Feb 2005 06:15:56 +0200

Consider using Thread Pools
that
Threads already running and waiting for job to do.
Glance to queue subject will be helpful also...

"Robin" <Robin@discussions.microsoft.com> wrote in message
news:8753E4C0-DBB9-48FA-8503-C1BA0988C9E7@microsoft.com...
> I am developing a network server application that will connect to around
200
> clients. The client software is already developed so I have to work within
> this constraint.
>
> The server listens for connections from clients and establishes a socket
> connection. The socket remains active until either the server or client
is
> shutdown.
>
> The clients send data to the server when they have new data to send or
when
> a status request has been made by the server.
>
> Most examples I have seen close the socket after the message is received
or
> the response is sent. How do I handle the situation where I have to keep
the
> sockets open and listen for more messages?
>
> There are a couple of approaches I but I'm not sure which,if either, is
the
> best.
>
> 1. Use the Async sockets methods (BeginRead etc...) At the end of each
> message I start a new BeginRead to wait for the next message. The problem
I
> see with this method is that it would require a thread for each client.
The
> upper limit for clients is around 200. Is it reasonable to have 200
threads?
>
> 2. Poll the sockets to see which have data available for reading using
> .Available or .Select., then use the Async methods to read the data.
>
> Any help is greatly appreciated.
>
>
> --
> Robin



Relevant Pages

  • Re: MsgCommunicator v.2.00: Instant Messenger SDK, now with databases support
    ... expect persistent connections. ... they will wait for the server to pick them up. ... your Clients can stay "off-line" for about 30 minutes before they have to ... requests *simultaneously*. ...
    (borland.public.delphi.thirdpartytools.general)
  • sockets, closing and TIME_WAIT
    ... During heavy load the server can't follow anymore because the sockets ... my server should be able to handle 10 clients connecting ... This gets a free position in the array of connections, ...
    (comp.unix.programmer)
  • Re: TCP/IP redundant connections
    ... The clients have persistent TCP connections to the server, ...
    (freebsd-hackers)
  • Re: Intermittent Network Connections
    ... I've just reconnected the Server LAN nic 1 to the ethernet switch (the same ... Server IP config and Client IP config attached. ... > turn is connected to an ADSL modem out to the internet The clients connect to ... >> Clients can sucessfully log in but periodically loose their connections. ...
    (microsoft.public.windows.server.sbs)
  • Establishing a p2p connection in python
    ... programming PHP on a webdeveloper basis. ... I thought that one approach could be to write a small server for my ... users and establishing p2p connections on demand. ... It would seem like the socket ...
    (comp.lang.python)