Sorry to go all technical, but I'm having real probs. with the Motorola J2ME's HttpConnection code (on a dial-up connection, if that's relevant). I'm writing a program which sends data to be processed by a Web-based CGI script. Basically, my program hangs when the HttpConnection is asked to switch from the Setup stage to the Connected stage - let me explain: HttpConnection c = (HttpConnection)Connector.open(queryURL); c.setRequestMethod(HttpConnection.POST); // Code makes it here. is = c.openInputStream(); // Code doesn't reach here. There's no feedback like exceptions to the console, and according to my "Connected To ..." Windows dialog box, no bytes have been sent out by my computer. I'm at a loss - even setting queryURL to something like "http://www.yahoo.com" (and removing the POST command) doesn't work. Is J2ME's HTTP connection code broken? Am I being really stupid? Is there some networking config. file I need to edit or configure?
Eric Giguere
Ranch Hand
Joined: Oct 25, 2000
Posts: 170
posted
0
Likely a bug. Have you tried running the same code in Sun's MIDP emulator? Eric
Yep, It's a Motorola-specific problem. The HttpConnection.POST should have been HttpConnection.GET, but then it worked fine with Sun's J2ME Wireless Toolkit. Either Motorola's code is buggy, or the SDK doesn't like being wired into Java 2 JDK 1.3 (it's meant to use 1.2, I think). Incidentally, there's a pretty good article on the kind of stuff I was doing at: http://developer.java.sun.com/developer/technicalArticles/wireless/midpnetwork/ Thanks, Alex
yufeng
Greenhorn
Joined: Dec 26, 2000
Posts: 2
posted
0
Change your URL "www.yahoo.com" to its ip address, it will work. It is because MotoSDK emulator doesn't provide DNS lookup emulation. -yu