I am developing a MIDlet to be run on
Nokia 6310i and I always get back
the IOException: invalid port when
making HTTP connection. Can anybody
explain why? HTTP should be supported
by MIDP 1.0.
Thanks,
Simon
Printable View
I am developing a MIDlet to be run on
Nokia 6310i and I always get back
the IOException: invalid port when
making HTTP connection. Can anybody
explain why? HTTP should be supported
by MIDP 1.0.
Thanks,
Simon
Hello,
I took got same error but mine is pecuilar i am getting the response for first time but when making a second conneciton its giving this probelm.
Did u get the solution.
Can you show your URL?And does your network work well?
Hi,
The thing is that i got this error on my Series 40 Nokia 6610 mobile but it was running perfectly on the emulator.
my request URL is
first request is
[url]http://202.63.107.106/frontend?UID=Login[/url]$1000000$spw1_1_1@yahoo.co.in$sfqatest$ROCKET$5
this was working fine
but second request is going for toss and request is
[url]http://202.63.107.106/frontend?UID=GetMobileAlbums[/url]$1112315578084990:3f3a526d47a64:1000:spw1_1_1@yahoo.co.in:SFOSTG02$0
I get java.io.IOException:invalid port on the device.
I'm having the same problems on my 6280. I figured out what's it all about: having a colon ':' in your URL makes the phone think you're trying to set a specific port to connect to.
So try to replace the colons with something else and it will (most probably) work.
The same problem exists in gcalsync. I've suggested replacing : with %3a and that would hopefully help.
But Nokia ought to make sure this bug gets fixed. I upgraded to the latest firmware in my Nokia 5300 and the problem is still there.
Thank you for this thread, which helped me a lot. By the way, [url=http://wiki.forum.nokia.com/index.php/TSJ000993_-_Limitation_on_using_%27:%27_character_in_Series_40]this issue[/url] is resolved in the Series 40 from late 2009 onwards. At least neither my [url=https://www.bluetooth.org/tpg/QLI_viewQDL.cfm?qid=15596]Nokia 2710 Navigation Edition[/url] nor my [url=https://www.bluetooth.org/tpg/QLI_viewQDL.cfm?qid=16596]Nokia X3-02[/url] are affected. Previous models raised a [i]NumberFormatException[/i] in [i]com.sun.midp.io.j2me.http.protocol.parsePort[/i] (+66) which lead to lead to a [i]IllegalArgumentException[/i].[QUOTE=norpan;279856]I've suggested replacing : with %3a and that would hopefully help.[/QUOTE]Indeed, [url=http://wiki.forum.nokia.com/index.php/How_to_encode_URL_in_Java_ME_%3F]encoding[/url] the parameter values does help.
Another trick is to append a port within the [url=http://tools.ietf.org/html/rfc3986#section-3.2]authority[/url].[code]http://www.example.com:80/
https://www.example.com:443/[/code]Then you can use the colon additional times.[QUOTE=alice77;145257]I am getting the response for first time but when making a second conneciton its giving this probelm.[/QUOTE]If you work with [post=436773]HTTP redirection[/post] and you want to stick to HTTP GET, make sure your server escapes its query parameters. Do not encode the whole query at once. Instead, encode each parameter-key and each parameter-value individually. Although this is not required by [url=http://tools.ietf.org/html/rfc3986#section-2]RFC 3986[/url], it does not hurt. Otherwise you have to parse the whole URL in your MIDlet if you re-use a HTTP location header.
[QUOTE=traud;804472]Thank you for this thread, which helped me a lot. By the way, [url=http://wiki.forum.nokia.com/index.php/TSJ000993_-_Limitation_on_using_%27:%27_character_in_Series_40]this issue[/url] is resolved in the Series 40 from late 2009 onwards. At least neither my [url=https://www.bluetooth.org/tpg/QLI_viewQDL.cfm?qid=15596]Nokia 2710 Navigation Edition[/url] nor my [url=https://www.bluetooth.org/tpg/QLI_viewQDL.cfm?qid=16596]Nokia X3-02[/url] are affected. Previous models raised a [i]NumberFormatException[/i] in [i]com.sun.midp.io.j2me.http.protocol.parsePort[/i] (+66) which lead to lead to a [i]IllegalArgumentException[/i].Indeed, [url=http://wiki.forum.nokia.com/index.php/How_to_encode_URL_in_Java_ME_%3F]encoding[/url] the parameter values does help.
Another trick is to append a port within the [url=http://tools.ietf.org/html/rfc3986#section-3.2]authority[/url].[code]http://www.example.com:80/
https://www.example.com:443/[/code]Then you can use the colon additional times.If you work with [post=436773]HTTP redirection[/post] and you want to stick to HTTP GET, make sure your server escapes its query parameters. Do not encode the whole query at once. Instead, encode each parameter-key and each parameter-value individually. Although this is not required by [url=http://tools.ietf.org/html/rfc3986#section-2]RFC 3986[/url], it does not hurt. Otherwise you have to parse the whole URL in your MIDlet if you re-use a HTTP location header.[/QUOTE]
i still could'nt get it working.i have the same problem,in which the URL doesnt open for the second time.
Strange thing is that my URL does'nt have a ':' apart from "http : //" 's colon
java.lang.IllegalArgumentException: invalid port
at com.sun.midp.io.j2me.http.Protocol.parsePort(+93)
at com.sun.midp.io.j2me.http.Protocol.parseURL(+18)
at com.sun.midp.io.j2me.http.Protocol.connect(+46)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+64)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+8)
at com.sun.midp.io.InternalConnector.openPrim(+157)
at com.sun.midp.io.InternalConnector.open(+9)
at javax.microedition.io.Connector.open(+6)
at javax.microedition.io.Connector.open(+6)
at javax.microedition.io.Connector.open(+5)
Hi agam.jain! Welcome to Nokia Developer Discussion Baords!! :)
In which platform / SDK are you trying ? Have you tried in a real device ?
Regards
Gopal
[QUOTE=agam.jain@hotmail.com;910064]i have the same problem,in which the URL doesnt open for the second time.[/QUOTE]Why do you open the same URL a second time? Because of redirection or a cookie?
Hello everyone, i am developing a j2me app, which run fine in emulator but gives java.io.ioexception -1 in nokia N97 mini mobile, please help me
Does it also say 'invalid port'? Just asking because in your other hijacked thread you do not mention that ([url]http://www.developer.nokia.com/Community/Discussion/showthread.php?231687-Java-io-IOException-in-J2me-application[/url]).
The "Post New Thread" button is just below the list of discussions on [url]http://www.developer.nokia.com/Community/Discussion/forumdisplay.php?16-Mobile-Java-General[/url]
ok thank you