Hi I'm trying to understand what is going on under the hood here.
I would expect a net.Conn after being closed from the far side, to issue an error if the near side then tries to write to it. On my local machine an error is returned on the second write, on the go playground all writes succeed. The test is shown below and is also here - https://play.golang.org/p/EFYX_ZehMKs Thanks for any insight, Piers func TestDetectClosedConnectionWhenWriting(t *testing.T) { listener, err := net.Listen("tcp", ":0") if err != nil { t.Fatal(err) } wait := make(chan struct{}) go func() { conn, err := listener.Accept() if err != nil { t.Fatal(err) } err = conn.Close() if err != nil { t.Fatal(err) } wait <- struct{}{} }() conn, err := net.Dial("tcp", listener.Addr().String()) if err != nil { t.Fatal(err) } <-wait for i := 0; i < 100; i++ { println(i) _, err = conn.Write([]byte("b")) if err != nil { break } } if err == nil { t.Fatal("expecting error to be returned when writing") } t.Fatal("expecting error to be a permanent net.OpError") } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.