Documentation
¶
Index ¶
- func ConnReceiveMessage(conn net.Conn, data interface{}) error
- func ConnSendMessage(conn net.Conn, data interface{}) error
- func IsSameSegmentIP(ip1, ip2 string, bc int) bool
- func RUDPReceiveAllMessage(conn *reliableUDP.ReliableUDP, timeout time.Duration, msg interface{}) (*net.UDPAddr, error)
- func RUDPSendMessage(conn *reliableUDP.ReliableUDP, addr string, msg interface{}, ...) error
- func RUDPSendUnreliableMessage(conn *reliableUDP.ReliableUDP, addr string, msg interface{}) error
- func RandPort() int
- func TCPRandListen() (*net.TCPListener, error)
- func UDPRandListen() (*net.UDPConn, error)
- type PortBitmap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnReceiveMessage ¶
func ConnSendMessage ¶
func IsSameSegmentIP ¶
func RUDPReceiveAllMessage ¶
func RUDPReceiveAllMessage(conn *reliableUDP.ReliableUDP, timeout time.Duration, msg interface{}) (*net.UDPAddr, error)
func RUDPSendMessage ¶
func RUDPSendMessage(conn *reliableUDP.ReliableUDP, addr string, msg interface{}, timeout time.Duration) error
发送超时时间为timeout,如果timeout为0则默认为4秒
func RUDPSendUnreliableMessage ¶
func RUDPSendUnreliableMessage(conn *reliableUDP.ReliableUDP, addr string, msg interface{}) error
func TCPRandListen ¶
func TCPRandListen() (*net.TCPListener, error)
func UDPRandListen ¶
Types ¶
type PortBitmap ¶
type PortBitmap struct {
// contains filtered or unexported fields
}
func NewPortBitmap ¶
func NewPortBitmap() *PortBitmap
NewPortBitmap initializes a PortBitmap with a size based on the maximum port number.
func (*PortBitmap) ClearPort ¶
func (pb *PortBitmap) ClearPort(port int) error
ClearPort clears the port as unused in the bitmap.
func (*PortBitmap) GetUsedPorts ¶
func (pb *PortBitmap) GetUsedPorts() []int
GetUsedPorts returns a list of all used ports.
func (*PortBitmap) IsPortSet ¶
func (pb *PortBitmap) IsPortSet(port int) (bool, error)
IsPortSet checks if the port is used in the bitmap.
func (*PortBitmap) SetPort ¶
func (pb *PortBitmap) SetPort(port int) error
SetPort sets the port as used in the bitmap.
Click to show internal directories.
Click to hide internal directories.