How to make Spark wait for more time for acknowledgement?

My connection is taking more time to receive the acknowledgment. And because the timeout is set less, the connection is ending before the acknowledgment is received. How can I increase the time to wait for acknowledgment?