Documentation ¶
Index ¶
- func NewNetConn(remoteAddress string, localAddress ...string) (conn *net.UDPConn, err error)
- func Write(address string, data []byte, retry ...Retry) error
- func WriteRead(address string, data []byte, buffer int, retry ...Retry) ([]byte, error)
- type Conn
- func (c *Conn) Read(buffer int, retry ...Retry) ([]byte, error)
- func (c *Conn) ReadWithTimeout(buffer int, timeout time.Duration, retry ...Retry) ([]byte, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(timeout time.Time) (err error)
- func (c *Conn) SetReadBufferWait(d time.Duration)
- func (c *Conn) SetReadDeadline(timeout time.Time) (err error)
- func (c *Conn) SetWriteDeadline(timeout time.Time) (err error)
- func (c *Conn) Write(data []byte, retry ...Retry) (err error)
- func (c *Conn) WriteRead(data []byte, buffer int, retry ...Retry) ([]byte, error)
- func (c *Conn) WriteReadWithTimeout(data []byte, buffer int, timeout time.Duration, retry ...Retry) ([]byte, error)
- func (c *Conn) WriteWithTimeout(data []byte, timeout time.Duration, retry ...Retry) error
- type Retry
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetConn ¶
NewNetConn 根据地址创建并返回一个 *net.UDPConn
Types ¶
type Conn ¶
Conn 对 UDP 连接的封装
func NewConnByNetConn ¶
NewConnByNetConn 根据 <udp> 创建一个 UDP 连接对象
func (*Conn) ReadWithTimeout ¶
ReadWithTimeout 指定时间内读取数据
func (*Conn) SetDeadline ¶
SetDeadline 设置读写超时时间
func (*Conn) SetReadBufferWait ¶
SetReadBufferWait 设置读取数据的缓冲区等待时间
func (*Conn) SetReadDeadline ¶
SetReadDeadline 设置读取数据的超时时间
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline 设置写入数据的超时时间
func (*Conn) WriteRead ¶
WriteRead 向连接写入数据并阻塞接受数据 参数 <data> 是要写入的数据 参数 <buffer> 是自定义缓冲区大小,如果 <buffer> <= 0,则使用默认大小 1024 可选参数 <retry> 用于重试
Click to show internal directories.
Click to hide internal directories.