Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrProgramMismatch = errors.New("Program Version mismatch") ErrGarbargeArguments = errors.New("Arguments not interpreted correctly") ErrSystemError = errors.New("Generic system error") ErrRPCMismatch = errors.New("Wrong RPC version") ErrAuthError = errors.New("Authentication error") ErrUnknownError = errors.New("Server returned unknown error") )
View Source
var (
ErrTargetSet = errors.New("Reply data destination has already been set")
)
Functions ¶
func IgnoreReply ¶
func IgnoreReply() callModifier
func WithStruct ¶
func WithStruct(data interface{}) callModifier
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Call ¶
Example ¶
package main import ( "github.com/JanBerktold/go-onc-rpc" ) var ( data = struct{}{} bytearray = make([]byte, 0) ) func main() { client, _ := rpc.DialTCP("localhost:111", rpc.Program{ Number: 10000, Version: 2, }) // do not forget error checking in the real world client.Call(4, rpc.NoReply()) client.Call(4, rpc.ToStruct(&data)) client.Call(4, rpc.WithBytes([]byte{0x1, 0x2}), rpc.NoReply()) client.Call(5, rpc.WithStruct(data), rpc.ToBytes(bytearray)) }
Output:
type Server ¶
type Server struct { }
Server represents a socket which can host multipli RPC programs
func (*Server) ListenTCP ¶
ListenTCP starts the server on the specified TCP address. Method call blocks as long as the server is running.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.