In my real server I use an external queue for every client.
Inside the OnDataAvailable callback, the packet is appended to the queue
of every socket.
The OnDataSent callback of every socket is used to get a new packet from
the queue and packets are aggregated to reach the MTU.
If the queue become too long for a socket, packets are dropped or the
client is disconnected.

The reason why I transmit a great number of packets is that if the
server can handle a number of 500 clients that transmit 1000 packet each
one, probably it can handle 5000 client that transmit 100 packets each
one. But I not be able to simulate 5000 client.

What I'm trying to do with this simulation environment is to understand
the server performance.
In the first scenario, where the server receive only, the behaviour is
quite clear: if the server is busy or the network is busy, then the
speed of the client is automatically reduced by the tcp sliding window
flow control.

In the second scenario, in which the server routes packets, I get the
stall of the clients. When one client stop to transmit, it never restart.
For me this behaviour is not clear.
I want to keep the routing loop as simple as possible, because my fear
is that, if I introduce one queue per client, that point becomes the
weak link in the chain.
I'd like that, if the server is not able to route this number of
packets, clients reduce their transmission speed, like in the first
scenario, but not stall forever.
I know that the send is async, so I can accept also the out of memory of
the server, at this step.
I think that tcp flow control + bidirectional transmission + routing +
async sockets cause the situation in which, when a tcp window goes to
zero, it can't grow up more and the client stops transmission forever.

I'm searching a way to modify the routing loop to avoid this behaviour.

Thank you,

Il 28/02/2012 20:15, François Piette ha scritto:
>> Do you think that routing cicle is ok? There is a better way to do that?
>> Can you give any advice about that?
> How do you solve the issue which can happen if a client is not receiving
> data fast enough ? The sending socket will buffer data (It is asynchronous
> on send as well) and all memory could be consumed if you don't kill client
> which do not receive data, or at least delete some data (the oldest or the
> newest).
> Also, with your system, data is duplicated as much as you have clients. This
> is a waste of memory and will not scale up nicely.
> --
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto
> Visit our website at

Ing. Emanuele Bizzarri
Software Development Department
e-works s.r.l.
41011 - Campogalliano - Modena - Italy 
tel. +39 059 2929081 int. 23
fax +39 059 2925035

e-mail: -
La presente comunicazione, che potrebbe contenere informazioni riservate e/o 
protette da segreto professionale, è indirizzata esclusivamente ai destinatari 
della medesima qui indicati. Le opinioni, le conclusioni e le altre 
informazioni qui contenute, che non siano relative alla nostra attività 
caratteristica, devono essere considerate come non inviate né avvalorate da 
noi. Tutti i pareri e le informazioni qui contenuti sono soggetti ai termini ed 
alle condizioni previsti dagli accordi che regolano il nostro rapporto con il 
cliente. Nel caso in cui abbiate ricevuto per errore la presente comunicazione, 
vogliate cortesemente darcene immediata notizia, rispondendo a questo stesso 
indirizzo di e-mail, e poi procedere alla cancellazione di questo messaggio dal 
Vostro sistema. E' strettamente proibito e potrebbe essere fonte di violazione 
di legge qualsiasi uso, comunicazione, copia o diffusione dei contenuti di 
questa comunicazione da parte di chi la abbia ricevuta per errore o in 
violazione degli scopi della presente. 
This communication, that may contain confidential and/or legally privileged 
information, is intended solely for the use of the intended addressees. 
Opinions, conclusions and other information contained in this message, that do 
not relate to the official business of this firm, shall be considered as not 
given or endorsed by it. Every opinion or advice contained in this 
communication is subject to the terms and conditions provided by the agreement 
governing the engagement with such a client. If you have received this 
communication in error, please notify us immediately by responding to this 
email and then delete it from your system. Any use, disclosure, copying or 
distribution of the contents of this communication by a not-intended recipient 
or in violation of the purposes of this communication is strictly prohibited 
and may be unlawful.

To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to