View Single Post
Old 11-01-2003, 03:29 PM  
darkone
Disabled
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default RaidenFTPD <=> ioFTPD

Lately this has been one of the hottest topic. So here's brief explanation of the problem:

ioFTPD uses graceful shutdown, which is described in msdn article:

http://msdn.microsoft.com/library/de..._closure_2.asp

use quote to get the url.. vbulletin doesn't seem to like urls this long

It means that after send operation, ioFTPD will wait until it receives FD_CLOSE from client (which is sent by client by issuing shutdown(socket, SD_SEND); closesocket() does not issue shutdown!). If FD_CLOSE, is not received, it (io) will wait until socket times out (hardcoded to 600seconds), or socket layer notifies it for inproper pipe closure.

Now why isn't ioftpd using the ordinary solution, and leaving close notification managment to kernel/winsock: it all comes down to one thing, scalability. This implementation allows ioftpd to have total control over socket buffers. And trust me, it's needed when there are several hundreds, or even thousands of connnections. (current build of ioftpd can handle up to 1024 connections... and it can do it without problems... that's what scalability is all about )

Here is a short example, how graceful shutdown should be done, when lingering is disabled:

1) send(socket, ...);
2) recv(socket, ...);
1) shutdown(socket, SD_SEND); // end of send operation
1) recv(socket, ...); // waits for 0
2) recv(socket, ...); // returns 0
2) shutdown(socket, SD_BOTH); // end of receive operation
2) closesocket(socket);
1) ... recv returns 0
1) shutdown(socket, SD_RECV);
1) closesocket(socket);

easy, uhh?
darkone is offline   Reply With Quote