BTcp

package
v0.0.0-...-eedd94a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TcpClient

type TcpClient struct {
	Timeout time.Duration
	Conn    net.Conn
	Send    chan []byte
	Read    chan []byte
	Status  bool
	Lock    sync.RWMutex
}

func New

func New() *TcpClient

初始化一个Client

func (*TcpClient) Connect

func (t *TcpClient) Connect(protocol, addr string) error

func (*TcpClient) Disconnect

func (t *TcpClient) Disconnect() error

func (*TcpClient) DoSend

func (t *TcpClient) DoSend(msg []byte)

func (*TcpClient) ReadLoop

func (t *TcpClient) ReadLoop()

func (*TcpClient) SendMsg

func (t *TcpClient) SendMsg(content string) error

func (*TcpClient) SetTimeout

func (t *TcpClient) SetTimeout(timeout time.Duration) *TcpClient

设置超时时间,注意这个时间是每一次数据接收响应的超时时间,而不是总共的超时时间

func (*TcpClient) Start

func (t *TcpClient) Start(cryptFlag bool, ReadCallback func([]byte))

Jump to

Keyboard shortcuts

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