Author Topic: Execute an external program - Solved.  (Read 2208 times)

Ok, so thinking this through. Would it be viable to send plain text containing the reason and reporter's name to a php script which will be authenticated to an external smtp server to send the e-mail?

Ok, so thinking this through. Would it be viable to send plain text containing the reason and reporter's name to a php script which will be authenticated to an external smtp server to send the e-mail?
yes

And on the Blockland side all I'd need to use to send the data is TCPObjects, correct?

Would it be viable to send plain text
Viable, yes.
A good idea, no.
You're not including any means of performing authentication, such as a password. And if you did, there's no way to secure it and prevent other people from intercepting the authentication

Seriously, just go with an external program hosted on your PC.
Such a program would use 20, maybe 30mb of RAM if you're using a huge framework like .NET....considerably less if you're using something native like C++.
If that's too much for your computer
then your resources are already dead
« Last Edit: September 21, 2015, 06:36:04 PM by Headcrab Zombie »

Alright, alright.



Codeblocks was being a bitch. It works now. It consumes 300kb of RAM and 1% total CPU usage.
« Last Edit: September 21, 2015, 09:12:31 PM by Pie Crust »


Probably because all of the bullstuff Codeblocks adds but the programs compiled with the compiler I usually use don't work in x64 environments. The same program uses 6kb of RAM in Windows XP.

Which compiler within Codeblocks do you use, Codeblocks is just the IDE but uses a separate compiler.


Did you use an increased optimization flag of something like -O2? if not, try adding that. You could even go to -O3 if you wanted.

With -O2, the program doesn't run. It crashes upon startup. -O3 works though. uses 42kb.

With -O2, the program doesn't run. It crashes upon startup. -O3 works though. uses 42kb.
That's actually really weird.


...

Code: [Select]
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<time.h>

int retTime;
void waitFor (unsigned int secs) {
retTime = time(0) + secs;     // Get finishing time.
while (time(0) < retTime);    // Loop until it arrives.
}

void main() {
while(1 == 1) {
printf("Revisando la carpeta...\n");
if( access( "report.txt", F_OK ) != -1 ) {
system("SendEmail.exe -f -snoop- -xu -snoop- -xp -snoop- -t -snoop-@sms.movistar.net.ar -u Reporte de un jugador -o message-file=report.txt -s smtp.live.com:25");
remove("report.txt");
printf("email mandado!\n");
} else {
printf("nada.\n");
}
waitFor(60);
}
}

---Before anyone calling me out for the bad habit of using void main(), the program isn't supposed to exit anyways.

If you're looking for ways to improve it, consider something like inotify (or https://msdn.microsoft.com/en-us/library/aa364417(VS.85).aspx on Windows) instead of sleeping.