In Go, a call to the net.Listener
type's Accept
method returns an error. However, is there a way to tell the difference between a transient error (ie, this connection failed to set up) vs a permanent error (ie, the listener is dead, such as a Unix domain socket file that was forcibly removed)? If I can't tell the difference, I run the risk of infinite looping and spitting out errors as fast as I can since each Accept
call will immediately return an error.
Figured it out. Errors returned by the net
package may be of the net.Error
type, which defines the Temporary() bool
method which reports whether the error is temporary.