ipc

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Send(msg uint, id uint32, data interface{}) error
	SendAndReceive(msg uint, id uint32, data interface{}, buf interface{}) error
	Receive(buf interface{}) (uint, uint32, error)
	SetHandler(msg uint, handler MessageHandler)
	HandleMessage() error
	Close() error
}

func Dial

func Dial(network, address string) (Connection, error)

type ConnectionHandler

type ConnectionHandler interface {
	OnConnect(c Connection) error
	OnClose(c Connection) error
}

type MessageHandler

type MessageHandler interface {
	HandleMessage(c Connection, msg uint, id uint32, data []byte) error
}

type Server

type Server interface {
	// Listen specified port to watch.
	Listen(net, addr string) error

	// SetHandler set handler for connection. The handler can add message
	// handler for the connection, and clean-up resource on close.
	SetHandler(handler ConnectionHandler)

	// Loop handles connection requests. If it sees I/O errors, it
	// automatically close port and return the error.
	Loop() error

	// Close the port, and it causes loop end.
	Close() error

	Addr() net.Addr
}

func NewServer

func NewServer() Server

Jump to

Keyboard shortcuts

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