go - Golang close net listener -
i having trouble closing listener can reopen on same port. writing proxy server hot-configurable - i.e (redirects/blocks etc) can adjusted on fly. proxy runs in go routine. problem having when reconfigure listener , proxy listener still using port previous configuration. (fyi listener global pointer) i'm trying like: to kill listener: func killproxy() { if listener != nil { log.println(" *** trying stop proxy server") (*listener).close() listener = nil } } before reconfiguring like: log.println("listener (s1): ", listener) if listener == nil { // start listener listen on connection. l, err := net.listen(conn_type, conn_host + ":" + conn_port) if err != nil { log.println("error here: ", err) } listener = &l //set pointer newly created listener } log.println("listener (s2): ", listener) however doesnt seem work - error: listener (s1): err...