×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    java.io.IOException: invalid port

    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

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    120
    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.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    103
    Can you show your URL?And does your network work well?

  4. #4
    Registered User
    Join Date
    Oct 2003
    Posts
    120

    Here is Request String

    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

    http://202.63.107.106/frontend?UID=Login$1000000$spw1_1_1@yahoo.co.in$sfqatest$ROCKET$5

    this was working fine

    but second request is going for toss and request is

    http://202.63.107.106/frontend?UID=GetMobileAlbums$1112315578084990:3f3a526d47a64:1000:spw1_1_1@yahoo.co.in:SFOSTG02$0

    I get java.io.IOException:invalid port on the device.

  5. #5
    Registered User
    Join Date
    Aug 2004
    Location
    Novi Sad, Serbia & Montenegro
    Posts
    11

    Re: Here is Request String

    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.

  6. #6
    Registered User
    Join Date
    Feb 2007
    Posts
    1

    Re: java.io.IOException: invalid port

    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.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: java.io.IOException: invalid port

    Thank you for this thread, which helped me a lot. By the way, this issue is resolved in the Series 40 from late 2009 onwards. At least neither my Nokia 2710 Navigation Edition nor my Nokia X3-02 are affected. Previous models raised a NumberFormatException in com.sun.midp.io.j2me.http.protocol.parsePort (+66) which lead to lead to a IllegalArgumentException.
    Quote Originally Posted by norpan View Post
    I've suggested replacing : with %3a and that would hopefully help.
    Indeed, encoding the parameter values does help.
    Another trick is to append a port within the authority.
    Code:
    http://www.example.com:80/
    https://www.example.com:443/
    Then you can use the colon additional times.
    Quote Originally Posted by alice77 View Post
    I am getting the response for first time but when making a second conneciton its giving this probelm.
    If you work with HTTP redirection 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 RFC 3986, it does not hurt. Otherwise you have to parse the whole URL in your MIDlet if you re-use a HTTP location header.

  8. #8
    Registered User
    Join Date
    Jan 2013
    Posts
    1

    Exclamation Re: java.io.IOException: invalid port

    Quote Originally Posted by traud View Post
    Thank you for this thread, which helped me a lot. By the way, this issue is resolved in the Series 40 from late 2009 onwards. At least neither my Nokia 2710 Navigation Edition nor my Nokia X3-02 are affected. Previous models raised a NumberFormatException in com.sun.midp.io.j2me.http.protocol.parsePort (+66) which lead to lead to a IllegalArgumentException.Indeed, encoding the parameter values does help.
    Another trick is to append a port within the authority.
    Code:
    http://www.example.com:80/
    https://www.example.com:443/
    Then you can use the colon additional times.If you work with HTTP redirection 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 RFC 3986, it does not hurt. Otherwise you have to parse the whole URL in your MIDlet if you re-use a HTTP location header.
    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)

  9. #9
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: java.io.IOException: invalid port

    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

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: java.io.IOException: invalid port

    Quote Originally Posted by agam.jain@hotmail.com View Post
    i have the same problem,in which the URL doesnt open for the second time.
    Why do you open the same URL a second time? Because of redirection or a cookie?

  11. #11
    Registered User
    Join Date
    Mar 2013
    Posts
    21

    Re: java.io.IOException: invalid port

    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

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: java.io.IOException: invalid port

    Does it also say 'invalid port'? Just asking because in your other hijacked thread you do not mention that (http://www.developer.nokia.com/Commu...me-application).
    The "Post New Thread" button is just below the list of discussions on http://www.developer.nokia.com/Commu...e-Java-General

  13. #13
    Registered User
    Join Date
    Mar 2013
    Posts
    21

    Re: java.io.IOException: invalid port

    ok thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×