Results 1 to 3 of 3
  1. #1
    FiniteRed is offline Member
    Join Date
    Feb 2011
    Posts
    8
    Rep Power
    0

    Unhappy DatagramConnection "The address is already in use"

    Hi Everyone

    I'm using a DatagramConnection to connect a cellular modem to a server to send and received data using (comparatively) lightweight UDP packets.

    Everything works fine until (for what ever reason) a connection cannot be established, after this point when ever the
    system trys to open a new Datagram connection I get the error:

    "The address is already in use"

    After a bit if searching I have discovered the SO_LINGER option on Socket connections, but cant seem to find how to set this sort of timeout on a DatagramConnection (I unfortunately cant use DatagramSocket as its not supported by my jvm version).

    It's odd because once the UDP connection fails, the DatagramConnection is closed in a 'finally' routine and the entire UDP connection object is binned and cleaned up by GC, but still I get "The address is already in use"

    If anyone has any suggestions I would be most grateful as i'm quite stuck!

    FR

  2. #2
    FiniteRed is offline Member
    Join Date
    Feb 2011
    Posts
    8
    Rep Power
    0

    Default Re: DatagramConnection "The address is already in use"

    Update:

    It was recommended to me to put the modem (first into and then out of) 'Aeroplane mode' to try to reset the wireless connection.
    This helps with resetting a flaky GPRS network but still does not clear the "The address is already in use" issue I am still seeing.

    I was thinking I could try rotating ports, if one becomes blocked, but it still does not solve the actual issue.

    Still hoping someone out there may have a suggestion?

    FR

  3. #3
    ngosti2000 is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: DatagramConnection "The address is already in use"

    Please provide the code snippet.It will help in understanding better what you are trying to accomplish.One of the reasons for throwing this error is when your server program tries to use a port thats already in use
    Last edited by ngosti2000; 12-02-2011 at 06:48 PM.

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2010, 05:21 PM
  2. Replies: 1
    Last Post: 01-21-2010, 10:20 AM
  3. Replies: 2
    Last Post: 02-02-2009, 12:29 PM
  4. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Posting Permissions

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