Documentation
¶
Overview ¶
Package gtcp provides UDP server and client implementations.
Index ¶
- func NewNetConn(raddr string, laddr ...string) (*net.UDPConn, error)
- func Send(addr string, data []byte, retry ...Retry) error
- func SendRecv(addr string, data []byte, receive int, retry ...Retry) ([]byte, error)
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Recv(length int, retry ...Retry) ([]byte, error)
- func (c *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) ([]byte, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) Send(data []byte, retry ...Retry) error
- func (c *Conn) SendRecv(data []byte, receive int, retry ...Retry) ([]byte, error)
- func (c *Conn) SendRecvWithTimeout(data []byte, receive int, timeout time.Duration, retry ...Retry) ([]byte, error)
- func (c *Conn) SendWithTimeout(data []byte, timeout time.Duration, retry ...Retry) error
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetRecvBufferWait(d time.Duration)
- func (c *Conn) SetRecvDeadline(t time.Time) error
- func (c *Conn) SetSendDeadline(t time.Time) error
- type Retry
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetConn ¶
创建标准库UDP链接操作对象
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
封装的链接对象
func (*Conn) RecvWithTimeout ¶
带超时时间的数据获取
func (*Conn) RemoteAddr ¶
func (*Conn) SendRecvWithTimeout ¶
func (c *Conn) SendRecvWithTimeout(data []byte, receive int, timeout time.Duration, retry ...Retry) ([]byte, error)
发送数据并等待接收返回数据(带返回超时等待时间)
func (*Conn) SendWithTimeout ¶
带超时时间的数据发送
func (*Conn) SetRecvBufferWait ¶
读取全部缓冲区数据时,读取完毕后的写入等待间隔,如果超过该等待时间后仍无可读数据,那么读取操作返回。 该时间间隔不能设置得太大,会影响Recv读取时长(默认为1毫秒)。
Click to show internal directories.
Click to hide internal directories.