Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
examples
cpp
features
unix_abstract
examples/cpp/features/unix_abstract/client.cc
Go to the documentation of this file.
1
// Copyright 2021 the gRPC authors.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <iostream>
16
#include <memory>
17
#include <string>
18
19
#include "examples/protos/helloworld.grpc.pb.h"
20
21
#include <
grpcpp/grpcpp.h
>
22
23
using
grpc::Channel
;
24
using
grpc::ClientContext
;
25
using
grpc::Status
;
26
using
helloworld::Greeter
;
27
using
helloworld::HelloReply
;
28
using
helloworld::HelloRequest
;
29
30
class
GreeterClient
{
31
public
:
32
GreeterClient
(std::shared_ptr<Channel>
channel
)
33
:
stub_
(
Greeter
::NewStub(
channel
)) {}
34
35
std::string
SayHello
(
const
std::string
& user) {
36
HelloRequest
request
;
37
request
.set_name(user);
38
HelloReply
reply;
39
ClientContext
context
;
40
Status
status
=
stub_
->SayHello(&
context
,
request
, &reply);
41
if
(
status
.
ok
()) {
42
return
reply.message();
43
}
44
std::cout <<
status
.error_code() <<
": "
<<
status
.error_message()
45
<< std::endl;
46
return
"RPC failed"
;
47
}
48
49
private
:
50
std::unique_ptr<Greeter::Stub>
stub_
;
51
};
52
53
int
main
(
int
argc,
char
** argv) {
54
std::string
target_str(
"unix-abstract:grpc%00abstract"
);
55
GreeterClient
greeter(
56
grpc::CreateChannel
(target_str,
grpc::InsecureChannelCredentials
()));
57
std::string
user(
"arst"
);
58
std::cout <<
"Sending '"
<< user <<
"' to "
<< target_str <<
" ... "
;
59
std::string
reply = greeter.
SayHello
(user);
60
std::cout <<
"Received: "
<< reply << std::endl;
61
62
return
0;
63
}
benchmark.request
request
Definition:
benchmark.py:77
testing::internal::string
::std::string string
Definition:
bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
hellostreamingworld_pb2.HelloRequest
HelloRequest
Definition:
hellostreamingworld_pb2.py:102
main
int main(int argc, char **argv)
Definition:
examples/cpp/features/unix_abstract/client.cc:53
status
absl::Status status
Definition:
rls.cc:251
framework.rpc.grpc_channelz.Channel
Channel
Definition:
grpc_channelz.py:32
channel
wrapped_grpc_channel * channel
Definition:
src/php/ext/grpc/call.h:33
grpcpp.h
GreeterClient
Definition:
grpc-helloworld.cc:73
GreeterClient::GreeterClient
GreeterClient(std::shared_ptr< Channel > channel)
Definition:
examples/cpp/features/unix_abstract/client.cc:32
helloworld.Greeter
Definition:
helloworld.py:32
grpc::CreateChannel
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
grpc::ClientContext
Definition:
grpcpp/impl/codegen/client_context.h:195
hellostreamingworld_pb2.HelloReply
HelloReply
Definition:
hellostreamingworld_pb2.py:109
GreeterClient::SayHello
std::string SayHello(const std::string &user)
Definition:
examples/cpp/features/unix_abstract/client.cc:35
grpc::protobuf::util::Status
GRPC_CUSTOM_UTIL_STATUS Status
Definition:
include/grpcpp/impl/codegen/config_protobuf.h:93
grpc::Status
Definition:
include/grpcpp/impl/codegen/status.h:35
absl::Status::ok
ABSL_MUST_USE_RESULT bool ok() const
Definition:
third_party/abseil-cpp/absl/status/status.h:802
context
grpc::ClientContext context
Definition:
istio_echo_server_lib.cc:61
grpc::InsecureChannelCredentials
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
Definition:
cpp/client/insecure_credentials.cc:69
GreeterClient::stub_
std::unique_ptr< Greeter::Stub > stub_
Definition:
grpc-helloworld.cc:102
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:46