[英]Tell whether net.Listener is dead
In Go, a call to the net.Listener
type's Accept
method returns an error. 在Go中,对
net.Listener
类型的Accept
方法的调用将返回错误。 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)? 但是,有没有办法分辨出瞬时错误(即,该连接建立失败)与永久性错误(即,侦听器已死,例如被强制删除的Unix域套接字文件)之间的区别? 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. 如果我不能分辨出差异,那么我将冒无限循环的风险,并尽可能快地吐出错误,因为每个
Accept
调用都会立即返回错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.