tcp_server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerClosed     = errors.New("tcp: Server closed")
	ErrAbortHandler     = errors.New("tcp: abort TCPHandler")
	ServerContextKey    = &contextKey{"tcp-server"}
	LocalAddrContextKey = &contextKey{"local-addr"}
)

Functions

func ListenAndServe

func ListenAndServe(addr string, handler TCPHandler) error

Types

type TCPHandler

type TCPHandler interface {
	ServeTCP(ctx context.Context, conn net.Conn)
}

type TcpServer

type TcpServer struct {
	Addr    string
	Handler TCPHandler

	BaseCtx     context.Context
	UpdateAt    time.Time
	ServiceName string

	WriteTimeout     time.Duration
	ReadTimeout      time.Duration
	KeepAliveTimeout time.Duration
	// contains filtered or unexported fields
}

func (*TcpServer) Close

func (srv *TcpServer) Close() error

func (*TcpServer) ListenAndServe

func (srv *TcpServer) ListenAndServe() error

func (*TcpServer) Serve

func (srv *TcpServer) Serve(l net.Listener) error

Jump to

Keyboard shortcuts

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