Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A j2me program for bandwidth test

 
Roger Zhao
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I wanna test the bandwidth when the cell phone and the server are in commnunication. I am jst write a program to test it. But I don't know much about its constructure.
Your advice will be helpful~Thanks a lot!
Roger
[ December 05, 2003: Message edited by: Roger Zhao ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's one approach:
1) Write your own little HTTP server that times the difference between first and last byte received from a HTTP request and then have it return the recorded speed as a response.
2) Write a Midlet which sends a HTTP POST request, including a relatively large body (just generate some junk to make up a large enough message), and displays the response content to the user.
 
Roger Zhao
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasse, What do you think is the better choice for the large enough message here? A array with large amount elements?
Thanks in advanced.
Roger
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forget arrays. Just write plain characters into the body of the HTTP request until you have a message between 20-50k.
Something like this:
 
Roger Zhao
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If use Http communication, I should write my own http server application,right? Where can I get some resource or examples about it.

What about the socket connection instead? Can I use implement it with socket connection?
[ December 06, 2003: Message edited by: Roger Zhao ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If use Http communication, I should write my own http server application,right? Where can I get some resource or examples about it.
Yes, in any case you need to write some kind of a server because with servlets, for example, the actual servlet class might be invoked after the whole request has arrived which makes it difficult to calculate the actual bandwidth. You could just check the HTTP specification at www.w3.org and start coding or google for keywords such as "java", "http", "server" (I'm sure there are plenty of people who have implemented a web server just to learn to code networking programs with Java).
What about the socket connection instead? Can I use implement it with socket connection?
Not all MIDP devices support the "socket://" protocol, only "http://", so there's a possibility that you won't be able to use it. Otherwise, it would be perfectly fine.
 
Roger Zhao
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasse, thanks for your advice. It works, but there is a puzzle I met now. The speed of the commnunication is lower and lower instead of the stable value. So I can not get the data correctly. What's the matter?
[ December 09, 2003: Message edited by: Roger Zhao ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difficult to say. Can you post some code?
 
Roger Zhao
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My hoster ask to me write a socket one for test! The puzzle is still on as what I said in the last post.
MIDlet Client:


Server Application:


Thanks!
[ December 09, 2003: Message edited by: Roger Zhao ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic