I'll try to explain it better. if i write: socket.send(...); socket.close(); socket = null; and send is async, i guess sending will not work properly in this way. How do i know if send() is still sending or not?