netx

package
v0.0.0-...-e9ebb46 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 4 Imported by: 14

Documentation

Index

Constants

View Source
const (
	DefaultNetwork      = "tcp"
	DefaultDialTimeout  = 6 * time.Second
	DefaultWriteTimeout = 6 * time.Second
	DefaultReadTimeout  = 6 * time.Second
	DefaultRetryDelay   = 2 * time.Second
	DefaultReadSize     = 1024 * 2
	DefaultMaxRetries   = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(address string, conf Config) (*Client, error)

func NewTcpClient

func NewTcpClient(address string, conf Config) (*Client, error)

func NewUdpClient

func NewUdpClient(address string, conf Config) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Receive

func (c *Client) Receive() ([]byte, error)

func (*Client) Send

func (c *Client) Send(data []byte) error

func (*Client) TcpRecv

func (c *Client) TcpRecv() ([]byte, error)

func (*Client) TcpSend

func (c *Client) TcpSend(data []byte) error

func (*Client) UdpRecv

func (c *Client) UdpRecv() ([]byte, error)

func (*Client) UdpSend

func (c *Client) UdpSend(data []byte) error

type Config

type Config struct {
	Network      string
	MaxRetries   int
	ReadSize     int
	DialTimeout  time.Duration
	WriteTimeout time.Duration
	ReadTimeout  time.Duration
	RetryDelay   time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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