Sorry you're not getting too many replies to your posts. It's just that your questions are a bit unstructured, but that's okay because that's just the stage you're at. I hope you'll forgive me if my suggestions are also unstructured.
It seems to me that your program shouldn't be written to be so PPP specific. What if the situation should change and the client and server need to be on the same LAN, over the Internet, or on the same machine? You would have to change your program for it to work. I can't think of any client or server program that I use that is aware if I'm using PPP or not.
So, your client program shouldn't worry about whether or not pppd connected successfully--only that the call to connect was successful. But before that, it has to worry about if the call to gethostbyname was successful. This is how to know what IP address to specify in the connect call. Your client program should accept a hostname to connect to. You could add a line in /etc/hosts to provide an IP address to the other end of the PPP connection. You can find out the IP address of the other end of the PPP link by running ifconfig while the PPP link is up; as far as I know, it stays the same.
There's an article at http://www.linuxjournal.com/article....rder=0&thold=0
that deals with some of this material.
In order to deal with the slow connection times associated with a PPP connection coming up or other errors, your client could use a back off algorithm for the gethostbyname and connect calls. For example, if the call to gethostbyname fails, it could wait 2 seconds and try again. If that fails wait 4 seconds then try, if that fails wait 6 seconds, and on and on to a configurable number of tries or amount of time to keep trying.
pppd runs some scripts, namely ip-up and ip-down when a PPP connection comes up and goes down respectively. You can do whatever you want in these scripts, and pppd passes a bunch of environment variables you can use in these scripts. See man pppd and the PPP HOWTO at http://www.tldp.org/HOWTO/PPP-HOWTO/index.html