I'm need to create a library or class which will open a net connection and communicate with a news server. Yes, I need to create it myself.
Hate to say this, but it might not be the news reader's place to start opening and closing internet connections. Most people have their own ways of doing this, and you can't know for sure how somebody's doing it.
What I'd do to be honest is ask the user how to dial up - pretty much everyone I know uses 'pppon' and 'pppoff' or something similar, so you could just fork and execute whatever the user says in your config screens. It'd look a little like this:
#include <sys/types.h> #include <sys/wait.h>
function connect(string pppon) { pid_t pid; if ( pid = fork() ) { // parent. in real life, you'll almost certainly want to // on here and wait for the child later, because // otherwise you'll stop processing your message queues. // best way to do this might be to either store the pid // somewhere useful, and wait for it before you try to // actually connect to the server, or you could register // a signal handler on SIGCHLD and reap the child process // there int status; waitpid(pid, &status, 0); } else { // child - execute the specified program // in reality you need to set ARGV[0] to be // the name of the program, but I can't think // of a dead-obvious way of doing that simply, // so I'll leave that as something for you to // work out. execvp(pppon.c_str(),NULL); } }
Warning: The above code will almost certainly not work.
Anyone got any good points to where to start? Using C++. Non-negotiable (one day universities will teach the Open Source Community way...)
Now might be a time to point out to them that they're not gods, and can't set the future any more than you or I. I'm not bitter. ;-)
HTH
Paul
[ This email came to you via the Anglian Linux User Group list ] [ If you only wish to recieve event announcements, email the ] [ SUBJECTs of "unsubscribe alug" and "subscribe alug-announce" ] [ to listserver@stu.uea.ac.uk -- We do need your support, tho' ]