network

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package network contains function of facilitate sending and receiving messages via UDP and TCP

Index

Constants

View Source
const UDPMsgRepetitions = 3

UDPMsgRepetitions is the number of repetitive transmission of UDP messages. According to the UPnP Device Architecture 2.0 spec, one message can be sent up to 3 times

Variables

This section is empty.

Functions

func Interfaces

func Interfaces(wanted []string) (infs []net.Interface, err error)

Interfaces returns the network interfaces that are available on the machine (i.e. the interfaces that are up and that are no loopback). If wanted is not empty, the content of that array is interpreted as interface names and only these for these names the corresponding network interfaces are determined and returned.

func SendTCP

func SendTCP(conn net.Conn, msg []byte) (err error)

SendTCP sends the message msg via connection conn

func SendUDP

func SendUDP(conn *net.UDPConn, addr *net.UDPAddr, msg []byte) (err error)

SendUDP sends the message msg via connection conn to address addr

func TCPConn

func TCPConn(addr string) (conn net.Conn, err error)

TCPConn creates a TCP network connection to address addr

func UDPConn

func UDPConn(inf net.Interface, addr *net.UDPAddr) (conn *net.UDPConn, err error)

UDPConn creates a UDP network connection via interface inf to address addr

Types

This section is empty.

Jump to

Keyboard shortcuts

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