Documentation ¶
Index ¶
- func NewNetConn(remoteAddress string, localAddress ...string) (*net.UDPConn, error)
- func Send(address string, data []byte, retry ...Retry) error
- func SendRecv(address string, data []byte, receive int, retry ...Retry) ([]byte, error)
- type Conn
- func (that *Conn) Recv(bufferSize int, retry ...Retry) ([]byte, error)
- func (that *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error)
- func (that *Conn) RemoteAddr() net.Addr
- func (that *Conn) Send(data []byte, retry ...Retry) (err error)
- func (that *Conn) SendRecv(data []byte, receive int, retry ...Retry) ([]byte, error)
- func (that *Conn) SendRecvWithTimeout(data []byte, receive int, timeout time.Duration, 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) SetRecvBufferWait(d time.Duration)
- func (that *Conn) SetRecvDeadline(t time.Time) error
- func (that *Conn) SetSendDeadline(t time.Time) error
- type Retry
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetConn ¶
NewNetConn 创建一个udp链接 远端的地址端口,必传 本地使用的地址端口,可选
Types ¶
type Conn ¶
Conn udp链接处理对象
func NewConnByNetConn ¶
NewConnByNetConn 传入底层的udp链接,包装出我们自定义的udp链接
func (*Conn) RecvWithTimeout ¶
func (that *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error)
RecvWithTimeout 读取数据,如果指定时间内未读取到数据,则报错返回
func (*Conn) SendRecvWithTimeout ¶
func (that *Conn) SendRecvWithTimeout(data []byte, receive int, timeout time.Duration, retry ...Retry) ([]byte, error)
SendRecvWithTimeout 发送数据,并阻塞等待读取数据,在指定的时间内为读取成功,则报错返回
func (*Conn) SendWithTimeout ¶
SendWithTimeout 发送数据,在指定的时间内如果还为发送完毕,则报错返回
func (*Conn) SetRecvBufferWait ¶
SetRecvBufferWait 设置从连接读取所有数据时的缓冲区等待超时。 等待时间不能太长,否则可能会延迟从远程地址接收数据。
func (*Conn) SetRecvDeadline ¶
SetRecvDeadline 单独设置链接的读超时时间
Click to show internal directories.
Click to hide internal directories.