Ian Lance Taylor
unread,Jun 5, 2019, 10:14:22 AM6/5/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kurtis Rader, 杜沁园, Inada Naoki, golang-nuts
On Wed, Jun 5, 2019 at 12:10 AM Kurtis Rader <
kra...@skepticism.us> wrote:
>
> On Tue, Jun 4, 2019 at 11:53 PM Inada Naoki <
songof...@gmail.com> wrote:
>>
>> conn.SetReadDeadline(time.Now())
>
>
> Did you test that solution? Setting a deadline only affects "future Read calls" according to the documentation. It cannot be used to timeout an extant read. Which is what I would expect given the available UNIX like kernel APIs. So while I have not tested this using a program written in Go I would not expect it to work and the equivalent solution definitely does not work in other languages I use regularly.
No, this does in fact work in Go. I should have thought of that. The
docs say, correctly, "SetReadDeadline sets the deadline for future
Read calls and any currently-blocked Read call."
Ian