netlistener

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListenerHolder

type ListenerHolder struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ListenerHolder holds an opened port that can only be handed off to 1 go routine.

func NewFromPortNumber

func NewFromPortNumber(portNumber int) (*ListenerHolder, error)

NewFromPortNumber opens a TCP listener based on the port number provided.

func (*ListenerHolder) Close

func (lh *ListenerHolder) Close() error

Close shutsdown the TCP listener.

func (*ListenerHolder) Number

func (lh *ListenerHolder) Number() int

Number returns the port number.

func (*ListenerHolder) Obtain

func (lh *ListenerHolder) Obtain() (net.Listener, error)

Obtain returns the TCP listener. This method can only be called once and is thread-safe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL