Checklist for android wifi programming

I am trying to code an android application that needs sending files between two android phones.The app in intended to send files of large size. So it needs to keep the connection for a while. My problem is that the communication breaks for some reasons that I still don't know. Sometimes I don't get to connect to the file sender(Server) and sometimes one device(Server or client) becomes unresponsive to the communication. I am using the java.lang.Thread class to run both Server and client.

Could some one please tell me what are the things need to be taken care of while programming and android application that needs wifi communication.

By the way, I am not asking for the solution for the problems I am facing. So don't be mad at me for not posting the code. I am just asking for the list of things one should know/take care of (about android, wifi and sockets) while programming sockets with android wifi. I am really new to android, wifi and socket programming.