Version: v0.0.0-...-9ac6e9e Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2020 License: LGPL-2.1 Imports: 9 Imported by: 0




This section is empty.


This section is empty.


func Ntohl

func Ntohl(packet []byte) (uint32, error)

func OurIPAddress

func OurIPAddress() (string, error)

func OurRandom

func OurRandom() int32

func OurRandom16

func OurRandom16() uint32

func OurRandom32

func OurRandom32() uint32

func ReadSocket

func ReadSocket(conn net.Conn, buffer []byte) (int, error)

ReadSocket reads data from the connection.

func SetupDatagramSocket

func SetupDatagramSocket(address string, port uint) *net.UDPConn

SetupDatagramSocket returns a udp connection of Listening to the specified port.


type GroupSock

type GroupSock struct {
	// contains filtered or unexported fields

GroupSock is used to both send and receive packets. As the name suggests, it was originally designed to send/receive multicast, but it can send/receive unicast as well.

func NewGroupSock

func NewGroupSock(addrStr string, portNum uint) *GroupSock

NewGroupSock returns a source-independent multicast group

func (*GroupSock) AddDestination

func (g *GroupSock) AddDestination(addr string, port uint)

AddDestination can add multiple destinations (addresses & ports) This can be used to implement multi-unicast.

func (*GroupSock) Close

func (g *GroupSock) Close()

Close is responsible for disconnection from client.

func (*GroupSock) DelDestination

func (g *GroupSock) DelDestination()

DelDestination can remove the destinations.

func (*GroupSock) GetSourcePort

func (g *GroupSock) GetSourcePort() uint

GetSourcePort returns the source port of system allocation.

func (*GroupSock) HandleRead

func (g *GroupSock) HandleRead(buffer []byte) (int, error)

HandleRead reads data from client connection.

func (*GroupSock) Output

func (g *GroupSock) Output(buffer []byte, bufferSize uint) bool

Output does the datagram send, to each destination.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL