Is there any scientific way for measuring latency ? ping'ing seems kind of stupid for measuring right latency of connection.(Maybe I am wrong and ping is reliable way) .
One caveat with using ping is that ISPs can very easily prioritize that traffic, so you could see results from ping that you might not see in your application.
Pinging works pretty well, but not perfectly. ICMP echo is treated specially by many "traffic shaping" appliances. Firewalls frequently blanket-drop pings from outside, and sometimes pings are given higher priority to aid in diagnostics.
Usually it's noticeable when this is going on (especially the blocking), so you only need to go to some other solution when you notice this.
Try tcptraceroute for comparison. Or you can eg, open up Wireshark, make a real connection and look at the relative times on packets for a real connection. Ping gives you a starting point, usually "best case".