ipc

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 9 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, data interface{}) error
	SendAndReceive(msg uint, data interface{}, buf interface{}) 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)
}

type MessageHandler

type MessageHandler interface {
	HandleMessage(c Connection, msg uint, 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