udpchan

package module
v0.0.0-...-582e157 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: MIT Imports: 1 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

udpchan Circle CI GoDoc

A tiny channel wrapper around UDP connections

Usage

It's pretty simple: call Connect or Listen and get a []byte channel back!

inbound, err := Listen(":9999", nil)
if err != nil {
	// handle err
}

outbound, err := Connect(":9999")
if err != nil {
	// handle err
}

message := []byte("foo")

// Send a message over UDP
outbound <- message

// Receive a message over UDP
read := <-inbound // = []byte("foo")

License

MIT

Documentation

Overview

Package udpchan provides a thin channel wrapper around UDP connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(address string) (chan<- []byte, error)

Connect dials to address and returns a send-only channel and an error.

func Listen

func Listen(address string, close chan bool) (<-chan []byte, error)

Listen starts a UDP listener at address and returns a read-only channel and an error. If a value is sent to close, the UDP socket will be closed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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