Results 1 to 3 of 3
- 10-31-2011, 11:35 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 8
- Rep Power
- 0
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
- 11-10-2011, 03:25 PM #2
Member
- Join Date
- Feb 2011
- Posts
- 8
- Rep Power
- 0
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
- 12-02-2011, 05:44 PM #3
Member
- Join Date
- Dec 2011
- Posts
- 4
- Rep Power
- 0
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 05:48 PM.
Similar Threads
-
connection = DriverManager.getConnection(DATABASE_URL,'"+userid +"','"+password+"');
By renu in forum New To JavaReplies: 3Last Post: 10-12-2010, 04:21 PM -
How to change my form design from "metal" to "nimbus" in Netbeans 6.7.1?
By mlibot in forum New To JavaReplies: 1Last Post: 01-21-2010, 09:20 AM -
how to sort "name" arraylist with its phone & address?
By anthrax in forum New To JavaReplies: 2Last Post: 02-02-2009, 11:29 AM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks