Android Question Error EADDRINUSE...

SAM ShamsulBahrim

Member
Licensed User
Longtime User
Hi,

I wonder if someone can assist me as I once a while do get the following pop up error "address already in use (EADDRINUSE)" upon I click to run my B4A apps. Indeed, I do have UDP and TCP sockets in my apps...and I also found this link "http://stackoverflow.com/questions/...ror-message-eaddrinuse-address-already-in-use" suggesting about:

You need to set SO_REUSEADDR before binding. Don't specify port in the constructor - create unbound socket instead with DatagramSocket(null), then set options, then bind() explicitly.


Any idea how to overcome the problem?
 

SAM ShamsulBahrim

Member
Licensed User
Longtime User
You are trying to open a port that is already open.


Thanks Erel. I placed my socket.close in the wrong place (under the Activity_Pause Sub). I've closed the socket under "If UserClosed = False". Now I placed it as the following:

Sub Activity_Pause (UserClosed AsBoolean)

If UserClosed = False Then

Else
myUDP.Close

End If

End Sub
 
Upvote 0
Top