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
test
cpp
end2end
server_crash_test_client.cc
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 2015 gRPC authors.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
#include <iostream>
20
#include <memory>
21
#include <sstream>
22
#include <string>
23
24
#include "absl/flags/flag.h"
25
26
#include <
grpc/support/log.h
>
27
#include <
grpcpp/channel.h
>
28
#include <
grpcpp/client_context.h
>
29
#include <
grpcpp/create_channel.h
>
30
31
#include "src/proto/grpc/testing/echo.grpc.pb.h"
32
#include "
test/cpp/util/test_config.h
"
33
34
ABSL_FLAG
(
std::string
, address,
""
,
"Address to connect to"
);
35
ABSL_FLAG
(
std::string
,
mode
,
""
,
"Test mode to use"
);
36
37
using
grpc::testing::EchoRequest;
38
using
grpc::testing::EchoResponse;
39
40
int
main
(
int
argc,
char
** argv) {
41
grpc::testing::InitTest
(&argc, &argv,
true
);
42
auto
stub
= grpc::testing::EchoTestService::NewStub(
grpc::CreateChannel
(
43
absl::GetFlag
(FLAGS_address),
grpc::InsecureChannelCredentials
()));
44
45
EchoRequest
request
;
46
EchoResponse
response
;
47
grpc::ClientContext
context
;
48
context
.
set_wait_for_ready
(
true
);
49
50
if
(
absl::GetFlag
(FLAGS_mode) ==
"bidi"
) {
51
auto
stream
=
stub
->BidiStream(&
context
);
52
for
(
int
i
= 0;;
i
++) {
53
std::ostringstream
msg
;
54
msg
<<
"Hello "
<<
i
;
55
request
.set_message(
msg
.str());
56
GPR_ASSERT
(
stream
->Write(
request
));
57
GPR_ASSERT
(
stream
->Read(&
response
));
58
GPR_ASSERT
(
response
.message() ==
request
.message());
59
}
60
}
else
if
(
absl::GetFlag
(FLAGS_mode) ==
"response"
) {
61
EchoRequest
request
;
62
request
.set_message(
"Hello"
);
63
auto
stream
=
stub
->ResponseStream(&
context
,
request
);
64
for
(;;) {
65
GPR_ASSERT
(
stream
->Read(&
response
));
66
}
67
}
else
{
68
gpr_log
(
GPR_ERROR
,
"invalid test mode '%s'"
,
69
absl::GetFlag
(FLAGS_mode).
c_str
());
70
return
1;
71
}
72
}
grpc::testing::InitTest
void InitTest(int *argc, char ***argv, bool remove_flags)
Definition:
test_config_cc.cc:28
main
int main(int argc, char **argv)
Definition:
server_crash_test_client.cc:40
log.h
grpc::ClientContext::set_wait_for_ready
void set_wait_for_ready(bool wait_for_ready)
Definition:
grpcpp/impl/codegen/client_context.h:285
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
mode
const char int mode
Definition:
bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
async_greeter_client.stub
stub
Definition:
hellostreamingworld/async_greeter_client.py:26
GPR_ASSERT
#define GPR_ASSERT(x)
Definition:
include/grpc/impl/codegen/log.h:94
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition:
gen_stats_data.py:38
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
channel.h
absl::GetFlag
ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag< T > &flag)
Definition:
abseil-cpp/absl/flags/flag.h:98
grpc::CreateChannel
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
GPR_ERROR
#define GPR_ERROR
Definition:
include/grpc/impl/codegen/log.h:57
ABSL_FLAG
ABSL_FLAG(std::string, address, "", "Address to connect to")
msg
std::string msg
Definition:
client_interceptors_end2end_test.cc:372
grpc::ClientContext
Definition:
grpcpp/impl/codegen/client_context.h:195
client_context.h
asyncio_get_stats.response
response
Definition:
asyncio_get_stats.py:28
test_config.h
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
i
uint64_t i
Definition:
abseil-cpp/absl/container/btree_benchmark.cc:230
create_channel.h
stream
voidpf stream
Definition:
bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:17