Adding timeout to the sending thread.