Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
margo
Commits
7f5f77e1
Commit
7f5f77e1
authored
Feb 16, 2017
by
Philip Carns
Browse files
update example server to show listening addr
parent
35e2b982
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/server.c
View file @
7f5f77e1
...
@@ -25,7 +25,13 @@ int main(int argc, char **argv)
...
@@ -25,7 +25,13 @@ int main(int argc, char **argv)
ABT_pool
progress_pool
;
ABT_pool
progress_pool
;
hg_context_t
*
hg_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
hg_class_t
*
hg_class
;
FILE
*
fp
;
char
proto
[
12
]
=
{
0
};
int
i
;
hg_addr_t
addr_self
;
char
addr_self_string
[
128
];
hg_size_t
addr_self_string_sz
=
128
;
if
(
argc
!=
2
)
if
(
argc
!=
2
)
{
{
fprintf
(
stderr
,
"Usage: ./server <listen_addr>
\n
"
);
fprintf
(
stderr
,
"Usage: ./server <listen_addr>
\n
"
);
...
@@ -49,6 +55,31 @@ int main(int argc, char **argv)
...
@@ -49,6 +55,31 @@ int main(int argc, char **argv)
return
(
-
1
);
return
(
-
1
);
}
}
/* figure out what address this server is listening on */
ret
=
HG_Addr_self
(
hg_class
,
&
addr_self
);
if
(
ret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"Error: HG_Addr_self()
\n
"
);
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
return
(
-
1
);
}
ret
=
HG_Addr_to_string
(
hg_class
,
addr_self_string
,
&
addr_self_string_sz
,
addr_self
);
if
(
ret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"Error: HG_Addr_self()
\n
"
);
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
HG_Addr_free
(
hg_class
,
addr_self
);
return
(
-
1
);
}
HG_Addr_free
(
hg_class
,
addr_self
);
for
(
i
=
0
;
i
<
11
&&
argv
[
1
][
i
]
!=
'\0'
&&
argv
[
1
][
i
]
!=
':'
;
i
++
)
proto
[
i
]
=
argv
[
1
][
i
];
printf
(
"# accepting RPCs on address
\"
%s://%s
\"\n
"
,
proto
,
addr_self_string
);
/* set up argobots */
/* set up argobots */
/***************************************/
/***************************************/
ret
=
ABT_init
(
argc
,
argv
);
ret
=
ABT_init
(
argc
,
argv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment