The debugging

There is a possibility to predefine three functions, such as: 3


FtpSetDebugHandler(FTP *,function)

Predefines function of protocol debugging. After the function is predefined, it is called with every sending/receiving messages from the server. The function, defined as a debug handler must do returns to the calling functions (FtpSendMessage/FtpGetMessage), but can also abort the program.


FtpSetErrorHandler(FTP *,function)

Predefines error handler. If the server's answer means, that the operation is not finished correctly, this function will be called. The result code is negative, if an error is occurs.


FtpSetIOHandler(FTP *,function)

Predefines handler of Input/Output processing. This function is called, when a connection to the server is broken. For example, when the network or the remote host is down. This handler also is called after the timeout of one character waiting expires.


FtpDebug(FTP *)

Turns on all standard debugging functions. $\textstyle \parbox{0.49\textwidth}{\underline{\bf FtpDebugError}\index{FtpDebugError}}$ $\textstyle \parbox{0.49\textwidth}{--- prints a string, taken from the server, and aborts the program;\hfill}$
$\textstyle \parbox{0.49\textwidth}{\underline{\bf FtpDebugDebug}\index{FtpDebugDebug}}$ $\textstyle \parbox{0.49\textwidth}{--- prints a string, taken from the server;\hfill}$
$\textstyle \parbox{0.49\textwidth}{\underline{\bf FtpDebugIO}\index{FtpDebugIO}}$ $\textstyle \parbox{0.49\textwidth}{--- prints string {\underline{\bf strerror(errno)}} and aborts the program.\hfill}$

All function for debugging have three arguments:
1. Pointer to FTP data structure;
2. Last returned value from the server. When errors occur, the value is less than 1;
3. Diagnostic string.


FtplibDebug(1 or 0)

Turns on/off autostart debug mode, when connection is established.