tree: 45a0700deedd12ef8f1a2610cd22604f2703e886 [path history] [tgz]
  1. example/
  2. LICENSE
  3. listener.go
  4. README.md
traffic_monitor/vendor/github.com/hydrogen18/stoppableListener/README.md

stoppableListener

An example of a stoppable TCP listener in Go. This library wraps an existing TCP connection object. A goroutine calling Accept() is interrupted with StoppedError whenever the listener is stopped by a call to Stop(). Usage is demonstrated below, and in example/example.go.

	originalListener, err := net.Listen("tcp", ":8080")
	if err != nil {
		panic(err)
	}

	sl, err := stoppableListener.New(originalListener)
	if err != nil {
		panic(err)
	}