Versions in this module Expand all Collapse all v2 v2.7.2 Aug 2, 2024 Changes in this version + const FreePortAddress + func GetFreePort() (port int, err error) + func GetFreePorts(count int) (ports []int, err error) + func MustGetFreePort() (port int) + 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 struct + func NewConn(remoteAddress string, localAddress ...string) (*Conn, error) + func NewConnByNetConn(udp *net.UDPConn) *Conn + func (c *Conn) Recv(buffer int, retry ...Retry) ([]byte, error) + func (c *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error) + func (c *Conn) RemoteAddr() net.Addr + func (c *Conn) Send(data []byte, retry ...Retry) (err 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) (err error) + func (c *Conn) SetBufferWaitRecv(d time.Duration) + func (c *Conn) SetDeadline(t time.Time) (err error) + func (c *Conn) SetDeadlineRecv(t time.Time) (err error) + func (c *Conn) SetDeadlineSend(t time.Time) (err error) + type Retry struct + Count int + Interval time.Duration + type Server struct + func GetServer(name ...interface{}) *Server + func NewServer(address string, handler func(*Conn), name ...string) *Server + func (s *Server) Close() (err error) + func (s *Server) GetListenedAddress() string + func (s *Server) GetListenedPort() int + func (s *Server) Run() error + func (s *Server) SetAddress(address string) + func (s *Server) SetHandler(handler func(*Conn))