client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrShutDown = errors.New("connection is shut down")

Functions

This section is empty.

Types

type Call

type Call struct {
	Seq           uint64
	ServiceMethod string      // format "<service>.<method>"
	Args          interface{} // args for method
	Reply         interface{} // reply from method
	Error         error       // method error
	Done          chan *Call  // method has completed
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(network string, address string, opts ...*codec.Option) (client *Client, err error)

start client to connect server network like "tcp",address like "0.0.0.0:8888"

func DialDefineFunc

func DialDefineFunc(f func(net.Conn, *codec.Option) (client *Client, err error), network string, address string, opts ...*codec.Option) (client *Client, err error)

func DialHTTP

func DialHTTP(network string, address string, opts ...*codec.Option) (*Client, error)

func NewClient

func NewClient(conn net.Conn, opt *codec.Option) (*Client, error)

func NewHTTPClient

func NewHTTPClient(conn net.Conn, opt *codec.Option) (*Client, error)

the httpClient only add http protocol processing to the original newclient architecture

func (*Client) Call

func (client *Client) Call(ctx context.Context, servericeMethod string, args, reply interface{}) error

use context.WithTimeout context object to controll call TimeOut

func (*Client) Close

func (client *Client) Close() error

close the connection

func (*Client) Go

func (client *Client) Go(servericeMethod string, args, reply interface{}, done chan *Call) *Call

func (*Client) IsAvailable

func (client *Client) IsAvailable() bool

Jump to

Keyboard shortcuts

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