Skip to content

Instantly share code, notes, and snippets.

@liamzebedee
Created October 28, 2012 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liamzebedee/3967375 to your computer and use it in GitHub Desktop.
Save liamzebedee/3967375 to your computer and use it in GitHub Desktop.
Go TCPListener.SetDeadline not working
package main
import (
"net"
"time"
)
func main() {
addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:31432")
l, err := net.ListenTCP("tcp", addr)
if err != nil {
println(err.Error())
}
l.SetDeadline(time.Now().Add(2 * time.Second))
_, err = l.AcceptTCP()
if err != nil {
println(err.Error())
}
}
Copy link

ghost commented Aug 15, 2013

works on latest master(at least):
AcceptEx tcp 127.0.0.1:31432: i/o timeout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment