2 Answers
2

It depends what do you mean.
If you want to measure network speed when downloading or uploading something you can create network connection, send some garbage and measure how long does it take to send. Better results can be achieved if both server and client sides are under your control.
But you can even write simple client that downloads file from external URL and measure how long does it take.

If you wish to know measure network parameters of other applications I recommend you to read about JPcap.