TCP侦听器截止日期您不一定需要额外的 go 例程(不断接受),只需指定一个Deadline.for 例子:for {    // Check if someone wants to interrupt accepting    select {    case <- someoneWantsToEndMe:         return // runs into "defer listener.Close()"    default: // nothing to do    }    // Accept with Deadline    listener.SetDeadline(time.Now().Add(1 * time.Second)    conn, err := listener.Accept()    if err != nil {        // TODO: Could do some err checking (to be sure it is a timeout), but for brevity        continue    }    go handleConnection(conn)}