Is really need to make the connection and login on every retry :? Or is it possible to just retry the send_pkt thing? Just asking.

On the other hand, on my opinion, this 40 should be user configurable, via a new datastore option.