×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    May 2009
    Posts
    95

    Server socket connection fails when resuming midlet

    Hi,

    I've got a server socket connection running all the time when my application is online but when my application gets suspended because of a call / battery low notification or something else, i get an exception:

    java.io.IOException: invalid handle during socket::write


    I don't touch the connection so i assume that it's failing just because the application is being paused.

    Anyone has every encountered this problem ? is there some kind of code so that the application will never be suspended and if there's a call it will be set to the background ?

    I fixed this with an SDK other than Nokia but i'm still restricted with the phone make (and i want this application to be suitable for various phones such as nokia, sony ericsson etc...), so i would like to have some function to fix my problem maybe just handle the connection not to fail, the thing is that i can't afford that the connection fails because it costs too much to re-connect, so it isn't a solution because i already thought about it :-/

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Server socket connection fails when resuming midlet

    The action taken by the device when there is an incoming call (or similar event) is device dependent, and is not under your control.

    On what device is this happening?

    To what are you connecting through the ServerSocketConnection?

    Graham.

  3. #3
    Regular Contributor
    Join Date
    May 2009
    Posts
    95

    Re: Server socket connection fails when resuming midlet

    So this is happening actually on an emulator of a particular phone (it's not a popular phone make and i prefer not to mention it here if it's not a problem) that particular phone make has their own sdk and i'm working with that but my actual target is to develop an application with the normal j2me sdk and use contactless api (nokia) and location api (which i'm currently using with this phone and obviously could be used with other phones)

    If location and/or contactless are available they will be loaded, else it's not a problem.

    That's why i'm asking if you might know some details that could help me identify the problem because i think that when the application gets suspended certain resources needs to be released ey ? We could talk about nokia for the time being so that i will know what other sdk's support and as i told you my main objective is to used the basic J2ME sdk so i'm not going to use nokia / or this phone make i'm telling you. Their functionality will be loaded dynamically during runtime.

    Btw: i'm actually using a Socket Connection not Server Socket Connection to connect to a php application on a server...

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Server socket connection fails when resuming midlet

    It would help if you'd tell us what SDK you're using. Most SDK emulators do not accurately represent the behaviour of the actual device. Incoming call issues really need to be tested on actual devices. It's not a question of what "SDK's support", it's a question of how devices behave.

    If there is an incoming call, network connections may well get closed, in which case you will need to re-establish connection. Most devices cannot support simultaneous voice and data.

    For many devices, there is nothing you can do to "handle" an incoming call - your application might simply be suspended without warning.

    Graham.

Similar Threads

  1. Problems with Unlock Midlet Server Connection
    By beddussa in forum Near Field Communication
    Replies: 27
    Last Post: 2011-06-03, 16:25
  2. Unlock MIDlet errors with No Server Connection
    By mmartinleon in forum Near Field Communication
    Replies: 7
    Last Post: 2008-09-25, 09:12
  3. Invoking MIDlet from a servlet using Socket Connection.
    By amuyeed in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2008-04-11, 01:37
  4. Socket or HTTP connection over Bluetooth- Nokia N70
    By Hiltarus in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2007-04-12, 14:55
  5. Problems with socket connection between client and server
    By Al_KaRaJo in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-11-15, 18:28

Posting Permissions

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