multicast

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// UDP multicast address in <HOST:PORT> format
	Address string
	// UDP multicast interface name
	IfName string
	// UDP multicast network type name: "udp", "udp4" (IPv4-only), "udp6" (IPv6-only)
	Net string
	// Size of the operating system's receive buffer associated with the connection.
	ReadBufferBytes int

	// Connection instance
	Conn *net.UDPConn
	// PubSub Topic instance
	Topic *pubsub.Topic

	// Message counter
	Counter
}

Client for Multicast

func (*Client) Broadcast

func (c *Client) Broadcast(b []byte) error

Broadcast writes to the client connetion interface and sleeps. Returns error

func (*Client) CreateBroadcasterConn

func (c *Client) CreateBroadcasterConn() error

Create Broadcaster Conn binds to the Client UDP network with address:port and returns Broadcaster connection or error

func (*Client) CreateListenerConn

func (c *Client) CreateListenerConn() error

Create Listener Conn binds to the Client UDP network with address:port and returns Listener connection or error

func (*Client) CreateTopicClient

func (c *Client) CreateTopicClient(projectID, topicName string) error

Create Topic creates a topic client to connect

func (*Client) Listen

func (c *Client) Listen(handler func(*net.UDPAddr, int, []byte)) error

Listen sets the UDPConn max datagram size and writes packets received to a buffer then generic hander. Returns error

func (*Client) LogCounter

func (c *Client) LogCounter()

Return the Client Counter totals

func (*Client) Ping

func (c *Client) Ping(b []byte) error

Ping continuously writes to the client connetion interface and sleeps. Returns error

func (*Client) Publish

func (c *Client) Publish() error

Publish sets the UDPConn max datagram size and writes packets received to a PubSub Topic. Returns error

func (*Client) PublishS

func (c *Client) PublishS() error

PublishS sets the UDPConn max datagram size and writes packets received as string to a PubSub Topic . Returns error

func (*Client) SetupCloseHandler

func (c *Client) SetupCloseHandler()

SetupCloseHandler creates a 'listener' on a new goroutine which will notify the program if it receives an interrupt from the OS. We then handle this by calling our clean up procedure and exiting the program.

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Message Counter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL