> > My point is: > > before: we were using OS provided buffers (which you can retrieve with > getsockopt()) and read/write to/from it at 1.4Kb max per operation; we did not > care to set socket buffers since OS uses a default size (maybe you have 8Kb > default, mine could be bigger or smaller) which is enough for every kind of > operation (but sometimes can be under optimal for a given kind of traffic). > > now: we force 64Kb, then in ftp you reduce it to 32Kb (so why set it at 64Kb > inside inet.c if 64Kb can cause data corruption?). After this change, we all > have 64Kb forced buffers for every kind of transmission we handle (BTW, code > inside inet.c is repeated a couple of times, why not add a single c-only > function which receives a socket and sets it at a certain size?).
Is needed to establish a buffer size more bigger than you can read to have enough time to read all meanwhile data transfers. If the buffer had the same size as we read then we always lost data, because in the time between readings, the buffer is filling without being able to continue to meet and these data will be lost. From 64k are usable 32k for security, and is a good default if you test speed over ftp, smtp and http. I don't test other protocols. We now not force to 64, only try, and use better buffer if is possible, but respect OS memory limitations, in some cases this buffer can be reduced to 200b for example and Inet works now too. > > In my opinion a better solution, and a solution which is guaranteed to work at > least as good as it was working before, would have been to add > SetSocket[Snd/Rcv]Buffer() calls so that if someone needs to change the OS > default it can do it from .prg code _but_ leave the code of inet.c as it was. These features have already been added: InetSetSndBufSize( pSocket, nSizeSendBuffer ) InetSetRcvBufSize( pSocket, nSizeReciveBuffer ) InetGetSndBufSize( pSocket ) InetGetRcvBufSize( pSocket ) Other protocols can reduce easily using this functions to change dynamically his buffers after connection. > Then, inside ftp client .prg code you could have set buffers to 32Kb since > this seems to give better results. Maybe my code works better with smaller > buffers, who knows, PPOE, dial-up connections with a small mtu and all the > weird thing that are out there. > FTP needs to establish 64 buffer size for use readings of 32 for not lost data entries. I study the way to set properly defaults at each protocol. Best regards, Miguel Angel Marchuet ------------------------------------------------------------------------- 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