How do I go about connecting to a server and check if there is a file to be downloaded using Java ME?
Should I use POST method, post all my required data to server and see what the server response back? And also what are the headers do I have to post together wit开发者_如何学运维h my data?
Or do I have to use a Get method?
You don't need it to do by hand. Just use
HttpConnection connection = Connector.open(url);
DataInputStream stream = connection.openDataInputStream();
while(stream.read() != -1) {
//your stuff if anything there
}
精彩评论