tcp_server

package
v0.0.0-...-2828958 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT 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"}
)

ErrServerClosed

Functions

This section is empty.

Types

type TCPHandler

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

TCPHandler TCP 处理器

type TCPServer

type TCPServer struct {
	Addr    string
	Handler TCPHandler

	BaseCtx context.Context

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

TCPServer xx

func (*TCPServer) Close

func (s *TCPServer) Close() error

Close 关闭连接

func (*TCPServer) ListenAndServe

func (s *TCPServer) ListenAndServe() error

ListenAndServe 监听开启服务

func (*TCPServer) Serve

func (s *TCPServer) Serve(l net.Listener) error

Serve 创建

Jump to

Keyboard shortcuts

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