Solution: add sleep after connecting such that sending is not started before connection succeeded
Attach a file by drag & drop or click to upload