Now all is clear!! :-)
Thanks,
Emanuele

Francois Piette ha scritto:
>> The problem was on the receiver side. Inside DataAvailable there
>> are onerous instructions for CPU. So winsock messages
>> tend to accumulate in Message queue.
>> When new packets arrive, the receiver progressively reduce
>> TCP sliding window until 0.
>>     
>
> That is perfectly correct and expected behaviour. If receiver is not able to
> process data quickly enough, sender has to pause sending. TCP window is
> there to avoid congestion with not acknowledged data packets while avoiding
> slow down because of round trip between sender and receiver. (Sending the
> next packet only when previous one has been acknowledged would drastically
> reduce thruput. The TCP window allow sender to send packet before having
> received ACK, but at most to the size of the TCP window).
>
> Back to the receiver code: with such processing, no winsock message can
> accumulate in the message queue. Only a single winsock message is posted in
> the queue whatever data is received. And no more message will be posted by
> winsock, even if more data comes in, until the application call Receive.
> There is not one message per packet, there is one message per call to
> receive (plus the initial message of course).
>
> At sender side, as TWSocket automatically buffer data, if you don't use
> OnDataSent to know when to send more data and instead simply send everything
> you have to send, you'll end up with all data in memory, in TWSocket send
> buffer. This means that if you have lots of data to send, send chunk by
> chunk (for example 4 or 8KB). Send next chunk when you receive OnDataSent
> event. This will produce a continuous flow because you receive OnDataSent
> when TWSocket has emptyed his buffer. At that time, winsock still has his
> own buffer full and continue to send while you are fetching data from disk
> or from elsewhere.
>
> Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
> --
> [EMAIL PROTECTED]
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be
>
>   


-- 
Ing. Emanuele Bizzarri
Software Development Department
E-Works s.r.l.
Direzionale 70 - Via Giardini 456/c
41100 Modena - Italy 
tel. +39 059 2929081
fax +39 059 2925035
e-mail: [EMAIL PROTECTED] - http://www.e-works.it
---------------------------------------------------------------------
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 http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to