NetProg

 


   

NETPROG  PRESENTATION

 

  OverView
  Functionalities
  Programming
API
C Examples
  Download
MXAddComCallBack C NetProg Library


#include "mx.h"
int MXAddComCallBack (MX* pmx, MXCom* pcom, char* dialogclassname, char* messageclassname, BYTE mode, int (*funct)(MXMessage* pmessage, MXCom* pcom, void* applicationfield), void* applicationfield)


Parameters Description
pmx  the MX manager
pcom  the connection instance
dialogclassname  the dialog class name
messageclassname  the message class name
mode  the mode that triggers the callback 
funct  the function to call when a message is received or sent
applicationfield  Programmer-specified data sent to the callback function


Description : 

This function adds a callback to the specified message class callback list. The callback is triggered when a message belonging to (dialogclassname, messageclassname) is received or sent on the connection instance pcom

The mode parameter can be : MXONRECV, MXONSEND, MXONRECEIVING, MXONSENDING

applicationfield specifies the argument that is to be passed to the specified procedure when it is invoked

Return Values : if error -1 else returns a value > 0


See Also : MXRemoveComCallBack, MXAddCallBack, MXRemoveCallBack, MXAddGeneralCallBack, MXRemoveGeneralCallBack 


Example :

 

   MX mx;
   MXMessage* pmessage;

   MXInit (&mx, MXSERVER, NULL, NULL, 0, NULL);

/* Establish Connection with FTP Server */

   FTPCom = MXOpenCom (&mx, "194.214.200.8", 21, IPPROTO_FTP, NULL, NULL, TRUE);
   if (!FTPCom) return 0;


   MXAddComCallBack (&mx, FTPCom, FTP_SYS, "Command", MXONSEND, Command, NULL);
   MXAddComCallBack (&mx, FTPCom, FTP_SYS, "Command_Reply", MXONRECV, CommandReply, NULL);
   MXAddComCallBack (&mx, FTPCom, FTP_SYS, "dir_reply", MXONRECV, DirReply, NULL);
   MXAddComCallBack (&mx, FTPCom, FTP_SYS, "get_reply", MXONRECV, GetReply, NULL);

....