Documentation
¶
Index ¶
- func NewNetConn(addr string, timeout ...time.Duration) (net.Conn, error)
- func NewNetConnTLS(addr string, tslConfig *tls.Config, timeout ...time.Duration) (net.Conn, error)
- type Conn
- func (that *Conn) Recv(length int, retry ...Retry) ([]byte, error)
- func (that *Conn) RecvLine(retry ...Retry) ([]byte, error)
- func (that *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error)
- func (that *Conn) Send(data []byte, retry ...Retry) error
- func (that *Conn) SendRecv(data []byte, length int, retry ...Retry) ([]byte, error)
- func (that *Conn) SendWithTimeout(data []byte, timeout time.Duration, retry ...Retry) (err error)
- func (that *Conn) SetDeadline(t time.Time) error
- func (that *Conn) SetRecvDeadline(t time.Time) error
- func (that *Conn) SetSendDeadline(t time.Time) error
- type Retry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetConn ¶
NewNetConn 创建并返回一个 net.Conn 链接,addr的格式为:"127.0.0.1:80", timeout为链接超时时间,如果不传则表示使用默认的30秒超时
Types ¶
type Conn ¶
Conn tcp链接对象
func NewConnByNetConn ¶
NewConnByNetConn 通过已有的net.Conn 创建一个tcp链接
func NewConnTLS ¶
NewConnTLS 创建一个TLS加密的tcp链接
func (*Conn) RecvWithTimeout ¶
func (that *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error)
RecvWithTimeout 在指定的时间内读取数据
func (*Conn) SendWithTimeout ¶
SendWithTimeout 在指定的时间内发送数据
func (*Conn) SetRecvDeadline ¶
SetRecvDeadline 设置读取超时时间
Click to show internal directories.
Click to hide internal directories.