Ron,

Ron Pinkas wrote:
> Miguel, Maurilio,
> 
> I see you guys going in circles. :-)
> 
yes :)

> 1. Indeed we should not ASSUME any size, we should either:
> 
>       - Find if there's a way to QUERY, what's the O/S buffer size.
> 
yes, there is, it is getsockopt(), which can tell you how big are OS default
buffers.

>    or:
> 
>       - Follow recommended practice incase no suck info needed, and thus
> no assumptions should be made.
> 
I think recommended practice, _for a runtime library_, should be to take what
the OS gives you and give to the programmer a way to change such defaults if
they can be changed. (Which Miguel did adding a few functions with which you
can query and/or set buffer sizes, I'm not against those functions and their
use inside ftp code, for example).

>    or:
> 
>       - Try to set reasonable size based on platform, and test for
> repeatedly lower sizes, until success.
This can be a very long and error prone task and, for every size we could
agree on, there will be some code which works sub-optimally.

So, in the end, take OS defaults and change them _in your code_ if and when
you see that your code could benefit from such a change.


> > 2. As maurilio suggested, FTP class is an specific application code,
> which may try to set arbitrarily bigger buffers.
> 
Surely, ftp class could set buffers to 64Kb and read/write in 32Kb chunks and
I could derive a new class from the ftp one and set them to 8Mb since I'm
using a 10Gb ethernet, or lower them because I'm writing code for an embedded
linux server where memory is a limited resource.

> IMO, the most important question is:
> 
>    Is there any stnadrd way to know the default system buffer size?
> Otherwise what is the recommended practice?
Yes, getsockopt() which tells you what the OS has as default size, and
setsockopt() to change those parameters.

But this 'optimitazion' should be made by user code, not by a low level,
protocol agnostic, runtime library.

Best regards.

Maurilio

-- 
 __________
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to