PDA

View Full Version : Communication with C/C++ program


yixin
07-08-2009, 01:23 AM
I`m in a software project in which we will use FTP server.
In this project we want the server send my C/C++ program a signal when a client upload a file.

Is there a script to realize this fonction?

thanks~

o_dog
07-08-2009, 06:18 AM
write one? What do you mean by signal?

yixin
07-08-2009, 10:18 PM
write one? What do you mean by signal?

About the signal, I dont konw how to say exactly. Genarally, it could be any way that my program on the same PC of the server can konw someone has upload a file without scanning the disk of the FTP server.

o_dog
07-09-2009, 06:14 AM
like executing the program?

jeza
07-09-2009, 02:09 PM
ioFTPD can execute your program on event OnUploadComplete.

[Events]
OnUploadComplete = EXEC path\to\your\program.exe
...


in this case ioFTPD will pass next arguments to you program:

phisical\path\of\the\uploaded\file
CRC32 sum of the file being uploaded
virtual\path\of\the\uploaded\file

yixin
07-09-2009, 10:25 PM
ioFTPD can execute your program on event OnUploadComplete.

[Events]
OnUploadComplete = EXEC path\to\your\program.exe
...


in this case ioFTPD will pass next arguments to you program:

phisical\path\of\the\uploaded\file
CRC32 sum of the file being uploaded
virtual\path\of\the\uploaded\file


This is very useful :)

P.S. Where can I fine the exact definition of the input arguments? I can'nt find them out in the changelog.txt

jeza
07-10-2009, 03:11 AM
i have no idea if there is a manual for that.
i usually use foreach loop trough inputs args, to see what is there.

u have also ioFTPD environmnet variables (PATH, USER, SPEED, ...) available in your program. u can find them in /etc/ folder i think.

just use a method as if u were looking for some WINDOWS ENV variable.


windows:
Environment.GetEnvironmentVariable("windir");
...

ioFTPD:
Environment.GetEnvironmentVariable("USER"); //username of the user who uploaded the file
Environment.GetEnvironmentVariable("SPEED"); //average speed the file was uplaoded with
...


here is also nice example to start with:
http://www.flashfxp.com/forum/showthread.php?t=5992