I put 64k because is the best default option for FTP transfers, is the same value that is used at FileZilla for example.
You can change dynamically now this value using InetSetSndBufSize( pSocket, nSizeSendBuffer ) InetSetRcvBufSize( pSocket, nSizeReciveBuffer ) Remember that before my modification we use hard coded 1400 bytes when by default Inet has 8Kb depending of memory free. Sometimes the buffer is reduced automatically under 1400bytes, in this cases FTP transfers was failing. Now we tries to use a minimum of 64kb if is possible to set. FTP transfers only use actually half buffer (32kb) to avoid data loss. If you want, you can create a SET DEFAULT_BUFFER_SND_SIZE TO <nSizeSendBuffer> SET DEFAULT_BUFFER_RCV_SIZE TO <nSizeReciveBuffer> To change the default value of 64Kb, But remember than this is actually the best tested size possible for FTP transfers. Also remember, which should normally only be used for half of the buffer to ensure non-data loss. Example at Leto RDD: HB_SOCKET_T hb_ipConnect( char * szHost, int iPort, int timeout ) { HB_SOCKET_T hSocket = -1; struct hostent *Host; struct sockaddr_in remote; HB_SOCKET_ZERO_ERROR(); Host = hb_getHosts( szHost, hSocket ); /* error had been set by get hosts */ if( Host != NULL ) { /* Creates comm socket */ #if defined(HB_OS_WIN_32) hSocket = socket( AF_INET, SOCK_STREAM, 0); #else hSocket = socket( PF_INET, SOCK_STREAM, 0); #endif if( hSocket == ( HB_SOCKET_T ) -1 ) { HB_SOCKET_SET_ERROR(); } else { remote.sin_family = AF_INET; remote.sin_port= iPort; remote.sin_addr.s_addr = (*(UINT *)Host->h_addr_list[0]); hb_socketConnect( hSocket, &remote, timeout ); /* Set internal socket send buffer to 64k, * this should fix the speed problems some users have reported */ { int value; int len = sizeof(value); if ( getsockopt( hSocket, SOL_SOCKET, SO_SNDBUF, (void *) &value, &len ) != SOCKET_ERROR ) { if (value < 65536) { value = 65536; setsockopt( hSocket, SOL_SOCKET, SO_SNDBUF, (void *) &value, sizeof( value ) ) } if (getsockopt( hSocket, SOL_SOCKET, SO_RCVBUF, (void *) &value, &len ) != SOCKET_ERROR ) { if (value < 65536) { value = 65536; setsockopt( hSocket, SOL_SOCKET, SO_RCVBUF, (void *) &value, sizeof( value ) ) } } } } } } return hSocket; } I'm tested all types of transfer, port mode and passive mode, Reducing a massive transfer from 45 min to 2.4 min (approx). What do you think about ? Best regards, Miguel Angel Marchuet Maurilio Longo escribió: > Miguel, > > I think it would be more 'correct' not to force 64K buffers, but simply give > the possibility to change the default value (which the OS sets). > > Do you agree? > > Maurilio. > > PS. If there was a hard-coded limit before, well, it was 'wrong' as well. > > Miguel Angel Marchuet wrote: >> 2008-04-01 12:42 UTC+0100 Miguel Angel Marchuet <[EMAIL PROTECTED]> >> * include\inet.h >> * source\tip\client.prg >> * source\tip\ftpcln.prg >> * source\vm\inet.c >> * Modified STOR method to execute GetReply at Port mode to sincronize >> ftp responses and >> not STOP connection. >> + Added dynamic buffer rcv and snd increasing by default 1400 to 64k to >> increase speed transfer. >> + Added high level functions to manage buffers >> InetGetSNDBufSize( pSocket ) >> InetGetRCVBufSize( pSocket ) >> InetSetSNDBufSize( pSocket, nBufSize ) >> InetSetRCVBufSize( pSocket, nBufSize ) >> * Corrected ftpclient to use increased buffers on transfers. >> * With these changes the transfer speed to be increased more than 10 >> times. I hope that can be >> exploited in LETO RDD and FTP transfers, and others. It is not tested >> on Linux machines, perhaps >> requires some modification. >> >> 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 >> > ------------------------------------------------------------------------- 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