net

package
v3.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Provides various utilities to construct listener

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTcpListener

func InitTcpListener(address string) (net.Listener, error)

Initializes TCP listener

error object would be viable if anything get failed

func InternetIP

func InternetIP() (ips []string, err error)

func MustInitTcpListener

func MustInitTcpListener(address string) net.Listener

[MUST] Initializes TCP listener

Panic would raise if anything get failed

Types

type ListenerController

type ListenerController struct {
	net.Listener
	// contains filtered or unexported fields
}

func NewListenerController

func NewListenerController(listener net.Listener) *ListenerController

Constructs the controller for usage on "net.Listener"

func (*ListenerController) AcceptLoop

func (c *ListenerController) AcceptLoop(connHandler func(conn net.Conn))

This method would keep accepting message of socket

This method would use go routine to call your conn handler.

func (*ListenerController) Close

func (c *ListenerController) Close()

Close this controller if any looping is running

Jump to

Keyboard shortcuts

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