Reputation: 709
If I set a deadline to a tcp connection, and I read and write it successfully, and I keep it alive for subsequence communction, does the deadline affect the next reading/writing? Should I set deadline to 0 for a connection after reading from/writing to it?
Upvotes: 2
Views: 5283
Reputation: 8385
The Conn interface also has deadline settings; either for the connection as a whole (
SetDeadLine()
) or specific to read or write calls (SetReadDeadLine()
andSetWriteDeadLine()
).Note that the deadlines are fixed points in (wallclock) time. Unlike timeouts, they don’t reset after a new activity. Each activity on the connection must therefore set a new deadline.
Emphasis mine.
From https://appliedgo.net/networking/ (second google search result).
Upvotes: 4