android – How can i start a socket more time in java?-ThrowExceptions

Exception or error:

I’m a new developer
I have an issue with my server program in Android Studio(Java). I’m trying to open a socket and send a message to the client.The first time is fine but when the main thread run the connection thread another time, the connection is established but i cant send message more. I’ve searched it and i think that the problem is the TCP port because i can’t reuse it, but i have to wait some minutes…What do you think? I did not try this solution because i want to be sure.Maybe i can declare the socket as global? thanks for help(Actually the socket is declared into the main thread)

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *