tcp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TcpDialTimeout time.Duration = 5 * time.Second
View Source
const TcpKeepIntvl time.Duration = 47 * time.Second // prime number that I chose for keep alive
View Source
const TcpReconIntvl time.Duration = 15 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol interface {
	Name() string
	Close()
	ReadLoop(*net.Conn)
}

type TcpClient

type TcpClient struct {
	// contains filtered or unexported fields
}

func NewTcpClient

func NewTcpClient(connectAddr string, protocol *Protocol, pinitwg *sync.WaitGroup) *TcpClient

func (*TcpClient) Init

func (c *TcpClient) Init()

func (*TcpClient) Protocol

func (c *TcpClient) Protocol() *Protocol

func (*TcpClient) Shutdown

func (c *TcpClient) Shutdown()

type TcpServer

type TcpServer struct {
	// contains filtered or unexported fields
}

func NewTcpServer

func NewTcpServer(listenAddr string, protocol *Protocol, pinitwg *sync.WaitGroup) *TcpServer

func (*TcpServer) Init

func (s *TcpServer) Init()

func (*TcpServer) Protocol

func (s *TcpServer) Protocol() *Protocol

func (*TcpServer) Shutdown

func (s *TcpServer) Shutdown()

Jump to

Keyboard shortcuts

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