|
MXCloseCom |
C
NetProg Library |
|
#include
"mx.h"
|
|
|
int MXCloseCom (MX*
pmx, MXCom* pcom) |
|
Parameters |
Description |
pmx |
the
MX manager |
pcom |
the
connection instance to close |
This function closes the
connection pcom. Call all callbacks related to the close event. All messages still in
the output and input queues are ignored. Application should use the function MXFlushCom
if it wants to send
all messages still in the output queue.
Return
Values : returns 1
|
MX mx;
MXMessage* pmessage;
char FileType = 't';
/*
Initialize MX manager */
MXInit (&mx, MXSERVER, NULL, NULL, 0,
NULL);
/* Open file where to store messages */
FileCom = MXOpenFile (&mx, "FTP.txt",
"w", IOPROTO_STORE, 'D', 0);
if (!FileCom) return;
/* Put messages in queue */
pmessage = MXPutMessage (FileCom,
FTP_SYS, "Command");
MXSetValue (pmessage,
"Value", 1, "USER");
MXSetValue (pmessage, "Par", 1, "bartocci");
pmessage = MXPutMessage (FileCom, FTP_SYS, "Command");
MXSetValue (pmessage, "Value", 1, "PASS");
MXSetValue (pmessage, "Par", 1, "john");
pmessage = MXPutMessage (FileCom, FTP_SYS, "dir");
MXSetValue (pmessage, "Value", 1, "LIST");
MXSetValue (pmessage, "Par", 1, "");
pmessage = MXPutMessage(FileCom, FTP_SYS, "get") ;
MXSetValue(pmessage, "FileName", 1, "t.c") ;
MXSetValue(pmessage, "DestName", 1, "t.c") ;
MXSetValue(pmessage, "FileType", 1, &FileType) ;
MXSetValue(pmessage, "Command", 1, "get") ;
MXFlushCom(&mx, FileCom); /*
send all messages in output queue */
MXCloseCom (&mx, FileCom);
/* close file */
...
|
|