Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetReadTimeout is ineffective #153

Closed
gopherbot opened this issue Nov 13, 2009 · 3 comments
Closed

SetReadTimeout is ineffective #153

gopherbot opened this issue Nov 13, 2009 · 3 comments

Comments

@gopherbot
Copy link

by azummo-google@towertech.it:

What steps will reproduce the problem?

func main()
{
        conn, _ := net.ListenPacket("udp", "0.0.0.0:1234");

        conn.SetReadTimeout(10000000e6);

        fmt.Printf("waiting.. %s\n", conn.LocalAddr().String());

        var buf [100]byte;

        for {
                n, _, err := conn.ReadFrom(&buf);

                if err == os.EAGAIN {
                        fmt.Printf("EAGAIN\n");
                        continue;
                }

                fmt.Printf("got %d bytes\n", n);
        }
}



What is the expected output? What do you see instead?

According to the doc, SetReadTimeout influences ReadFrom.
The default is zero, which means that the call must block.
Instead it immediately returns EAGAIN, regardless of SetReadTimeout.

This happens because the socket is always set up
in NONBLOCK mode.

What is your $GOOS?  $GOARCH?
linux/686

Which revision are you sync'ed to?  (hg log -l 1)
changeset:   4030:52ad1606d994
tag:         tip
user:        Rob Pike <r@golang.org>
date:        Fri Nov 13 13:15:18 2009 -0800
summary:     Explain why
@rsc
Copy link
Contributor

rsc commented Nov 14, 2009

Comment 1:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 15, 2009

Comment 2:

Owner changed to r...@golang.org.

@rsc
Copy link
Contributor

rsc commented Nov 17, 2009

Comment 3:

This issue was closed by revision 6e788e0.

Status changed to Fixed.

Merged into issue #-.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants