Example #1
0
func Dial() *rpc.Client {
	httpClient := &http.Client{}
	buf := &bytes.Buffer{}
	codec := &Codec{
		client: httpClient,
		enc:    gob.NewEncoder(buf),
		encBuf: buf,
	}
	codec.m.Lock()
	return rpc.NewClientWithCodec(codec)
}
Example #2
0
func Dial(netw, laddr, raddr string) (*rpc.Client, os.Error) {
	conn, err := net.Dial(netw, laddr, raddr)
	if err != nil {
		return nil, err
	}

	codec := NewClientCodec(conn)
	client := rpc.NewClientWithCodec(codec)

	return client, nil
}
Example #3
0
// NewClient returns a new rpc.Client to handle requests to the
// set of services at the other end of the connection.
func NewClient(conn io.ReadWriteCloser) *rpc.Client {
	return rpc.NewClientWithCodec(NewClientCodec(conn))
}