File: README.md

package info (click to toggle)
golang-github-hydrogen18-stoppablelistener 0.0~git20151210.0.dadc9cc-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 68 kB
  • sloc: makefile: 3
file content (18 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
	}
```