Home arrow static arrow Java Programming [Archive] - Network Programming -
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Network Programming -
10 Duke Stars available
This topic has 4 replies on 1 page.

Posts:5
Registered: 6/17/04
Network Programming -   
Jun 17, 2004 10:15 PM



 
Hi Everyone,

I want to write a Jav Applet which allows users to test their bandwidth. I know there are alot out there
but I want to write one myself.

I need the Applet to to have button where once pressed downloads a 1Mb zip file from a webserver
and uploads the same 1Mb file to the webserver then workout how long it took to transfer both files
and spit this figure back out to the browser for the user to see.

My question would I use Java Sockets or uRL.openConnection() to do this? I just dont know how to go about this. Im assuming the Applet would connect to a Servlet which will send the file
to the Applet? Can this be done by invoking FTP somehow. I dont need to physically save the files anywhere just tme how long they take to download and upload. Any ideas would be greatly appreciated.

Thanks all,

Kyle.
 

Posts:2,909
Registered: 13.8.2003
Re: Network Programming -   
Jun 17, 2004 10:20 PM (reply 1 of 4)



 
Well, if the applet is on the same server as the 1MB file (or the server can generate 1MB of data, there's no reason to have a file) you can create a socket connection to it provided you can program the server too. If you can't do anything to the server, you can use HTTP GET to get the file (in this case you do need it) and estimate the speed with it.

It's probably the easiest to do with HttpURLConnection.
 

Posts:5
Registered: 6/17/04
Re: Network Programming -   
Jun 17, 2004 10:50 PM (reply 2 of 4)



 
Thanks for the reply,
The applet and servlet will be residing on the same server. you said that

" the server can generate 1MB of data, there's no reason to have a file"
how is this possible? and how can this be timed then?

thanks for all ya help.

Kyle.
 

Posts:2,909
Registered: 13.8.2003
Re: Network Programming -   
Jun 17, 2004 11:19 PM (reply 3 of 4)



 
Well, I meant that if you can code both the server portion and the client portion, the server can just send random data for 1MB's worth. But if you don't want to code the server part, you need to GET a file with HTTP.

The timing happens on the client side (i.e. get time, read data, get time, subtract the first from the second, etc. etc.)
 

Posts:5
Registered: 6/17/04
Re: Network Programming -   
Jun 18, 2004 12:10 AM (reply 4 of 4)



 
cheers for that,

another question could something like this be done in PHP? it sounds like
a fairly easy app.

any php guru out there know
thanks man.
 
This topic has 4 replies on 1 page.