i suppose thatthe problem is because my arduino is already server (or client), and is not able to open and close different connection!
You suppose incorrectly, then. The Arduino can be server and client at the same time, with proper code. Clearly the problem is that you do not have proper code. My crystal ball says that the problem is between lines -3454 and line 455445445567789098765434567890987654.
Of course, it is cracked and full of algae, so it's a little hard to read.