lineserver

package
v3.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2014 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

lineserver emulates a line-based UDP server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncReadline

type AsyncReadline struct {
	LineCh chan string // Lines read are written to this channel
	ErrCh  chan error  // Error returned by ReadString is written to this channel (once).
	*bufio.Reader
}

AsyncReadline provides a non-blocking version of bufio.Reader.ReadString('\n') using goroutines.

func NewAsyncReadline

func NewAsyncReadline(r *bufio.Reader) *AsyncReadline

func (*AsyncReadline) Run

func (r *AsyncReadline) Run()

type LineServer

type LineServer struct {
	Ch chan string

	tomb.Tomb // provides: Done, Kill, Dying
	// contains filtered or unexported fields
}

LineServer is a line-based UDP server à la `nc -u -l`. Ch channel will receive incoming lines from all clients.

func NewLineServer

func NewLineServer(proto, addr string) (*LineServer, error)

func NewLineServerTCP

func NewLineServerTCP(addr string) (*LineServer, error)

func NewLineServerUDP

func NewLineServerUDP(addr string) (*LineServer, error)

func (*LineServer) GetUDPAddr

func (srv *LineServer) GetUDPAddr() (*net.UDPAddr, error)

func (*LineServer) Start

func (srv *LineServer) Start()

Directories

Path Synopsis
cmd
lineserver command

Jump to

Keyboard shortcuts

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