tfSmtpUserSetAsyncCB

Jump to: navigation, search

Table of Contents >> Optional Protocols >> SMTP


#include <trsocket.h>


int tfSmtpUserSetAsyncCB (
ttSmtpClientHandle smtpClientHandle,
ttSmtpAsyncCbFuncPtr asyncCbFuncPtr
);


Function Description

If you are running a non-blocking SMTP client and need more responsiveness (see Performance concerns when using non-blocking mode), you can hook into the asynchronous socket event callback used by the SMTP client. Your asynchronous SMTP event callback function will be alerted when there is activity on the underlying TCP socket that requires a call tfSmtpUserExecute(). Knowing exactly when to call tfSmtpUserExecute() to service replies from the server can speed up your non-blocking session if you require a lot of SMTP transactions (many recipients or messages).

This function can safely be called from an asynchronous SMTP event callback function.

To use this feature you must uncomment the following configuration macro in trsystem.h.

#define TM_USE_SMTP_ASYNC_CB
Warning Warning: The SMTP asynchronous event callback can occur in the receive task or timer task (or possibly others). You must not call any SMTP API functions from this user callback function, unless the function explicitly allows it. Doing so is not supported and will produce unpredictable results. You should also avoid any calls that could block the calling context, as this could degrade performance of the entire Treck stack.


Parameters


Returns

  • TM_ENOERROR
    Success.
  • TM_EINVAL
    Invalid SMTP client session handle.


Table of Contents >> Optional Protocols >> SMTP