Connecting to any URL: java.io.IOException TCP Open
I have a midlet that reads some bytes from google to test, it runs ok on my nokia and sony ericsson cellphones but in "Samsung GT-E2120L cellphone it doesn't work, I get "java.io.IOException TCP Open" Exception when I try to get the connection response code
HttpConnection conn = (HttpConnection) Connector.open("http://www.google.com");
// The exception throws HERE
int rc = conn.getResponseCode();
byte[] buff = new byte[255];
conn.openInputStream().read(buff);
Note: I have credit :)
Note2: I can access to google from native navigator of the "Samsung cellphone"
Note3: I had tried to Connect to the URL with 3 diferent modes: Connector.READ,Connector.WRITE, Connector.READ_WRITE
Note4: My application is not trusted but I have the "javax.microedition.io.Connector.http" API Permissions
Note5: I know that the read buffer[255] is hard coded but it's only for test
Anyone can he开发者_Python百科lp me? Thanks in advance and thanks for reading
"java.io.IOException TCP Open" - is it all that you get from exception?
If you declared javax.microedition.io.Connector.http in MIDlet-Permissions try to delete it. Really you don't need this parameter if your midlet is unsigned.
Some samsung mobiles (D600, E200) have bug: after some time without any correlations with actions were did they became unavailable to use internet from midlets. May be it's your case?
And as commentator said it could be different settings for accessing internet from java.
精彩评论