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.