Skip to content

hydrogen18/stoppableListener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)
	}

About

An example of a stoppable TCP listener in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages