Apart from that you can go with what modoran said: "To get public IP address just make your web server respond with this information. From your application just connect to the web server and read the response using libcurl or sockets or whatever."

i have already have written coding for IPCONFIG/ALL , now i want PUBLIC IP address only BY CONNECTING THROUGH SERVER(Because i have already written the code to get PUBLIC IP through short cut process, but that is not Standard process).