33 static std::string client_name;
34 static DWORD start_time = 0;
53 fprintf(stderr,
"Cannot open \"%s\", errno %d (%s)\n",
file_name.c_str(), errno, strerror(errno));
57 if (client_name.empty())
65 fputs(
str.c_str(), f);
71int main(
int argc,
char **argv)
123#if defined(SIGPIPE) && defined(SIG_IGN)
124 signal(SIGPIPE, SIG_IGN);
127 setbuf(stdout, NULL);
128 setbuf(stderr, NULL);
146 printf(
"mserver main, name [%s]\n",
name);
147 for (
i=0;
i<=argc;
i++)
148 printf(
"argv[%d] is [%s]\n",
i, argv[
i]);
149 system(
"/bin/ls -la /proc/self/fd");
152 if (getenv(
"MIDAS_MSERVER_DO_NOT_USE_CALLBACK_ADDR"))
159 inetd = (getsockopt(0, SOL_SOCKET, SO_TYPE, (
void *) &flag, &size) == 0);
163 for (
i = 1;
i < argc;
i++)
164 if (argv[
i][0] ==
'-' && argv[
i][1] ==
'd')
169 for (
i = 0;
i < argc;
i++)
174 if (argc < 7 && inetd) {
180 if (!inetd && argc < 7)
181 printf(
"%s started interactively\n", argv[0]);
185 if (argc < 7 || argv[1][0] ==
'-') {
195 for (
i = 1;
i < argc;
i++) {
196 if (strncmp(argv[
i],
"-e", 2) == 0) {
198 }
else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'd')
200 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'D')
202 else if (argv[
i][0] ==
'-' && argv[
i][1] ==
'p')
203 port = strtoul(argv[++
i], NULL, 0);
204 else if (argv[
i][0] ==
'-') {
205 if (
i + 1 >= argc || argv[
i + 1][0] ==
'-')
209 printf(
"usage: mserver [-e Experiment] [-s][-t][-m][-d][-p port]\n");
210 printf(
" -e experiment to connect to\n");
211 printf(
" -m Multi process server (default)\n");
212 printf(
" -p port Listen for connections on specifed tcp port. Default value is taken from ODB \"/Experiment/midas server port\"\n");
214 printf(
" -D Become a daemon\n");
215 printf(
" -d Write debug info to stdout or to \"/tmp/mserver.log\"\n\n");
217 printf(
" -d Write debug info\"\n\n");
231 sprintf(
str,
"Arguments: ");
232 for (
i = 0;
i < argc;
i++)
233 sprintf(
str + strlen(
str),
" %s", argv[
i]);
241 printf(
"Becoming a daemon...\n");
248 printf(
"cannot connect to experiment \"%s\", status %d\n",
expt_name,
status);
259 int size =
sizeof(odb_port);
270 printf(
"mserver will listen on TCP port %d\n", port);
278 printf(
"Cannot start server, rpc_register_server() status %d\n",
status);
375 printf(
"Cannot start mserver, rpc_server_callback() status %d\n",
status);
380 int semaphore_alarm, semaphore_elog, semaphore_history, semaphore_msg;
401 printf(
"rpc_test: %d %d %d %1.1f %1.1lf\n", b, w,
i, f,
d);
412static int test2(
INT routine_id,
void *prpc_param[])
416 if (
CINT(0) != 123) {
423 if (
CINT(2) != 456) {
430 if (strcmp(
CSTRING(3),
"test string") != 0) {
436 cm_msg(
MERROR,
"rpc_test2",
"CINT(5) string_out size mismatch");
440 strcpy(
CSTRING(4),
"string_out");
443 cm_msg(
MERROR,
"rpc_test2",
"CINT(7) string2_out size mismatch");
447 strcpy(
CSTRING(6),
"second string_out");
450 cm_msg(
MERROR,
"rpc_test2",
"CINT(9) string_inout size mismatch");
454 if (strcmp(
CSTRING(8),
"string_inout") != 0) {
459 strcpy(
CSTRING(8),
"return string_inout");
478 strcpy(pkey->
name,
"out_name");
494 strcpy(pkey->
name,
"inout_name");
502 if (
CINT(iarg+1) != 36) {
503 cm_msg(
MERROR,
"rpc_test2",
"CINT(%d) array_in size mismatch", iarg+1);
508 uint32_t size =
CINT(iarg+1)/4;
509 for (uint32_t
i=0;
i<size;
i++) {
510 if (((uint32_t*)
CARRAY(iarg))[
i] !=
i*10) {
511 cm_msg(
MERROR,
"rpc_test2",
"CARRAY(%d) dwordarray_inout mismatch at %d, %d vs %d", iarg,
i, ((uint32_t*)
CARRAY(iarg))[
i],
i*10);
517 for (
int i=0;
i<5;
i++) {
529 if (
CINT(iarg+1) != 10) {
530 cm_msg(
MERROR,
"rpc_test2",
"CINT(%d) array_in size mismatch", iarg+1);
535 for (
int i=0;
i<
CINT(iarg+1);
i++) {
536 if (((
char*)
CARRAY(iarg))[
i] !=
'a'+
i) {
537 cm_msg(
MERROR,
"rpc_test2",
"CARRAY(%d) array_in data mismatch at %d, %d vs %d", iarg,
i, ((
char*)
CARRAY(iarg))[
i],
'a'+
i);
547 if (
CINT(iarg+1) != 16) {
548 cm_msg(
MERROR,
"rpc_test2",
"CINT(%d) array_out size mismatch", iarg+1);
552 strcpy((
char*)
CARRAY(iarg),
"test test test");
553 CINT(iarg+1) = 1 + strlen((
char*)
CARRAY(iarg));
565 if (
CINT(0) != 123) {
572 if (
CINT(2) != 456) {
579 if (strcmp(
CSTRING(3),
"test string") != 0) {
585 cm_msg(
MERROR,
"rpc_test2_cxx",
"CINT(5) string_out size mismatch");
589 strcpy(
CSTRING(4),
"string_out");
592 cm_msg(
MERROR,
"rpc_test2_cxx",
"CINT(7) string2_out size mismatch");
599 cm_msg(
MERROR,
"rpc_test2_cxx",
"CINT(9) string_inout size mismatch");
604 cm_msg(
MERROR,
"rpc_test2_cxx",
"CSTDSTRING(8) mismatch");
619 cm_msg(
MERROR,
"rpc_test2_cxx",
"CARRAY(10) KEY mismatch");
627 strcpy(pkey->
name,
"out_name");
637 cm_msg(
MERROR,
"rpc_test2_cxx",
"CARRAY(12) KEY mismatch");
643 strcpy(pkey->
name,
"inout_name");
651 if (
CINT(iarg+1) != 36) {
652 cm_msg(
MERROR,
"rpc_test2_cxx",
"CINT(%d) dwordarray_inout size mismatch", iarg+1);
657 uint32_t size =
CINT(iarg+1)/4;
658 for (uint32_t
i=0;
i<size;
i++) {
659 if (((uint32_t*)
CARRAY(iarg))[
i] !=
i*10) {
660 cm_msg(
MERROR,
"rpc_test2_cxx",
"CARRAY(%d) dwordarray_inout mismatch at %d, %d vs %d", iarg,
i, ((uint32_t*)
CARRAY(iarg))[
i],
i*10);
666 for (
int i=0;
i<5;
i++) {
679 cm_msg(
MERROR,
"rpc_test2_cxx",
"CSTDVECTOR(%d) array_in size mismatch, %zu vs expected %d", iarg,
CSTDVECTOR(iarg).size(), 10);
686 cm_msg(
MERROR,
"rpc_test2_cxx",
"CSTDVECTOR(%d) array_in data mismatch at %zu, %d vs %d", iarg,
i, ((
char*)
CSTDVECTOR(iarg).
data())[
i],
'a'+(
int)
i);
696 if (
CINT(iarg+1) != 16) {
697 cm_msg(
MERROR,
"rpc_test2_cxx",
"CINT(%d) array_out size mismatch", iarg+1);
701 const char* array_out_string =
"test test test";
702 size_t array_out_string_size = 1 + strlen(array_out_string);
704 CINT(iarg+1) = array_out_string_size;
716 if (
CINT(0) != 123) {
723 if (
CINT(2) != 456) {
730 if (strcmp(
CSTRING(3),
"test string") != 0) {
736 cm_msg(
MERROR,
"rpc_test3_cxx",
"CINT(5) string_out size mismatch");
740 strcpy(
CSTRING(4),
"string_out");
743 cm_msg(
MERROR,
"rpc_test3_cxx",
"CSTDSTRING(6) string2_out size mismatch");
750 cm_msg(
MERROR,
"rpc_test3_cxx",
"CSTDSTRING(6) mismatch");
767 cm_msg(
MERROR,
"rpc_test3_cxx",
"CARRAY(%d) KEY mismatch", iarg);
777 strcpy(pkey->
name,
"out_name");
789 cm_msg(
MERROR,
"rpc_test3_cxx",
"CARRAY(%d) KEY mismatch", iarg);
795 strcpy(pkey->
name,
"inout_name");
803 if (
CINT(iarg+1) != 36) {
804 cm_msg(
MERROR,
"rpc_test3_cxx",
"CINT(%d) dwordarray_inout size mismatch", iarg+1);
809 uint32_t size =
CINT(iarg+1)/4;
810 for (uint32_t
i=0;
i<size;
i++) {
811 if (((uint32_t*)
CARRAY(iarg))[
i] !=
i*10) {
812 cm_msg(
MERROR,
"rpc_test3_cxx",
"CARRAY(%d) dwordarray_inout mismatch at %d, %d vs %d", iarg,
i, ((uint32_t*)
CARRAY(iarg))[
i],
i*10);
818 for (
int i=0;
i<5;
i++) {
831 cm_msg(
MERROR,
"rpc_test3_cxx",
"CSTDVECTOR(%d) array_in size mismatch, %zu vs expected %d", iarg,
CSTDVECTOR(iarg).size(), 10);
838 cm_msg(
MERROR,
"rpc_test3_cxx",
"CSTDVECTOR(%d) array_in data mismatch at %zu, %d vs %d", iarg,
i, ((
char*)
CSTDVECTOR(iarg).
data())[
i],
'a'+(
int)
i);
849 cm_msg(
MERROR,
"rpc_test3_cxx",
"CSTDVECTOR(%d) array_out size mismatch", iarg);
853 const char* array_out_string =
"test test test";
854 size_t array_out_string_size = 1 + strlen(array_out_string);
867 if (
CINT(0) != 123) {
874 if (
CINT(2) != 456) {
882 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDSTRING(3) mismatch");
889 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDSTRING(5) mismatch");
899 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDVECTOR(%d) array_in size mismatch, %zu vs expected %d", iarg,
CSTDVECTOR(iarg).size(), 10);
906 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDVECTOR(%d) array_in data mismatch at %zu, %d vs %d", iarg,
i, ((
char*)
CSTDVECTOR(iarg).
data())[
i],
'a'+(
int)
i);
917 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDVECTOR(%d) array_out size mismatch", iarg);
921 const char* array_out_string =
"test test test";
922 size_t array_out_string_size = 1 + strlen(array_out_string);
930 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDVECTOR(%d) array_inout size mismatch, %zu vs expected %d", iarg,
CSTDVECTOR(iarg).size(), 6);
937 cm_msg(
MERROR,
"rpc_test4_cxx",
"CSTDVECTOR(%d) array_in data mismatch at %zu, %d vs %d", iarg,
i, ((
char*)
CSTDVECTOR(iarg).
data())[
i],
'a'+(
int)
i);
942 for (
size_t i=0;
i<6;
i++) {
982 switch (routine_id) {
1059 if (convert_flags) {
1098 if (convert_flags) {
1216 if (convert_flags) {
1235 if (convert_flags) {
1433 cm_msg(
MERROR,
"rpc_server_dispatch",
"received unknown RPC %d", routine_id);
INT al_trigger_alarm(const char *alarm_name, const char *alarm_message, const char *default_class, const char *cond_str, INT type)
INT bm_open_buffer(const char *buffer_name, INT buffer_size, INT *buffer_handle)
INT bm_send_event(INT buffer_handle, const EVENT_HEADER *pevent, int unused, int timeout_msec)
static int bm_skip_event(BUFFER *pbuf)
INT bm_close_all_buffers(void)
INT bm_add_event_request(INT buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, EVENT_HANDLER *func, INT request_id)
INT bm_receive_event_vec(INT buffer_handle, std::vector< char > *pvec, int timeout_msec)
INT bm_set_cache_size(INT buffer_handle, size_t read_size, size_t write_size)
INT bm_receive_event(INT buffer_handle, void *destination, INT *buf_size, int timeout_msec)
INT bm_remove_event_request(INT buffer_handle, INT request_id)
INT bm_close_buffer(INT buffer_handle)
INT bm_flush_cache(int buffer_handle, int timeout_msec)
INT cm_set_path(const char *path)
INT cm_yield(INT millisec)
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
INT cm_check_client(HNDLE hDB, HNDLE hKeyClient)
INT cm_execute(const char *command, char *result, INT bufsize)
INT cm_get_watchdog_info(HNDLE hDB, const char *client_name, DWORD *timeout, DWORD *last)
INT cm_cleanup(const char *client_name, BOOL ignore_timeout)
std::string cm_get_client_name()
INT cm_set_client_info(HNDLE hDB, HNDLE *hKeyClient, const char *host_name, char *client_name, INT hw_type, const char *password, DWORD watchdog_timeout)
INT cm_disconnect_experiment(void)
INT cm_synchronize(DWORD *seconds)
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
INT cm_exist(const char *name, BOOL bUnique)
INT cm_set_experiment_semaphore(INT semaphore_alarm, INT semaphore_elog, INT semaphore_history, INT semaphore_msg)
INT cm_set_experiment_name(const char *name)
INT el_submit(int run, const char *author, const char *type, const char *syst, const char *subject, const char *text, const char *reply_to, const char *encoding, const char *afilename1, const char *buffer1, INT buffer_size1, const char *afilename2, const char *buffer2, INT buffer_size2, const char *afilename3, const char *buffer3, INT buffer_size3, char *tag, INT tag_size)
RPC_LIST * rpc_get_internal_list(INT flag)
INT ss_suspend_init_odb_port()
INT ss_semaphore_create(const char *name, HNDLE *semaphore_handle)
INT ss_daemon_init(BOOL keep_stdout)
INT ss_suspend_set_server_listener(int listen_socket)
int cm_msg_early_init(void)
INT cm_msg_log(INT message_type, const char *facility, const char *message)
INT cm_msg_flush_buffer()
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
INT cm_msg_retrieve(INT n_message, char *message, INT buf_size)
INT db_flush_database(HNDLE hDB)
INT db_remove_open_record(HNDLE hDB, HNDLE hKey, BOOL lock)
INT db_get_data_index(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT idx, DWORD type)
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
INT db_find_link(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
INT db_reorder_key(HNDLE hDB, HNDLE hKey, INT idx)
static const KEY * db_get_parent(const DATABASE_HEADER *pheader, const KEY *pkey, int *pstatus, const char *caller, db_err_msg **msg)
INT db_open_database(const char *xdatabase_name, INT database_size, HNDLE *hDB, const char *client_name)
INT db_get_open_records(HNDLE hDB, HNDLE hKey, char *str, INT buf_size, BOOL fix)
INT db_set_link_data(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
INT db_get_path(HNDLE hDB, HNDLE hKey, char *path, INT buf_size)
INT db_set_link_data_index(HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
INT db_get_record_size(HNDLE hDB, HNDLE hKey, INT align, INT *buf_size)
INT db_get_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
INT db_create_key(HNDLE hDB, HNDLE hKey, const char *key_name, DWORD type)
INT db_check_record(HNDLE hDB, HNDLE hKey, const char *keyname, const char *rec_str, BOOL correct)
INT db_copy_xml(HNDLE hDB, HNDLE hKey, char *buffer, int *buffer_size, bool header)
INT db_get_record(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align)
INT db_set_mode(HNDLE hDB, HNDLE hKey, WORD mode, BOOL recurse)
INT db_get_next_link(HNDLE hDB, HNDLE hKey, HNDLE *subkey_handle)
INT db_save(HNDLE hDB, HNDLE hKey, const char *filename, BOOL bRemote)
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
INT db_get_link(HNDLE hDB, HNDLE hKey, KEY *key)
INT db_load(HNDLE hDB, HNDLE hKeyRoot, const char *filename, BOOL bRemote)
INT db_set_data_index(HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
INT db_get_key_info(HNDLE hDB, HNDLE hKey, char *name, INT name_size, INT *type, INT *num_values, INT *item_size)
INT db_close_all_databases(void)
INT db_set_data(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
INT db_enum_link(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
INT db_set_data1(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
INT db_get_data1(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type, INT *num_values)
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
INT db_get_link_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
INT db_rename_key(HNDLE hDB, HNDLE hKey, const char *name)
INT db_get_key_time(HNDLE hDB, HNDLE hKey, DWORD *delta)
INT db_set_client_name(HNDLE hDB, const char *client_name)
INT db_notify_clients_array(HNDLE hDB, HNDLE hKeys[], INT size)
INT db_set_record(HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align)
INT db_set_data_index1(HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type, BOOL bNotify)
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
INT db_create_record(HNDLE hDB, HNDLE hKey, const char *orig_key_name, const char *init_str)
INT db_add_open_record(HNDLE hDB, HNDLE hKey, WORD access_mode)
INT db_set_num_values(HNDLE hDB, HNDLE hKey, INT num_values)
INT db_create_link(HNDLE hDB, HNDLE hKey, const char *link_name, const char *destination)
INT db_close_database(HNDLE hDB)
#define RPC_DB_ADD_OPEN_RECORD
#define RPC_DB_SET_DATA_INDEX
void rpc_convert_data(void *data, INT tid, INT flags, INT total_size, INT convert_flags)
#define RPC_DB_CLOSE_DATABASE
#define RPC_BM_ADD_EVENT_REQUEST
#define RPC_DB_CREATE_RECORD
#define RPC_CM_CHECK_CLIENT
#define RPC_DB_CREATE_LINK
#define RPC_DB_NOTIFY_CLIENTS_ARRAY
#define RPC_BM_MARK_READ_WAITING
#define RPC_BM_SEND_EVENT
INT rpc_register_functions(const RPC_LIST *new_list, RPC_HANDLER func)
INT rpc_server_callback(struct callback_addr *pcallback)
#define RPC_DB_DELETE_KEY
#define RPC_CM_SYNCHRONIZE
#define RPC_DB_SET_NUM_VALUES
#define RPC_BM_GET_BUFFER_INFO
#define RPC_CM_SET_CLIENT_INFO
#define RPC_BM_REMOVE_EVENT_REQUEST
void rpc_debug_printf(const char *format,...)
INT rpc_server_loop(void)
#define RPC_DB_SET_CLIENT_NAME
#define RPC_DB_REMOVE_OPEN_RECORD
#define RPC_DB_CLOSE_ALL_DATABASES
INT rpc_set_mserver_path(const char *path)
#define RPC_DB_SET_LINK_DATA_INDEX
#define RPC_BM_CLOSE_BUFFER
#define RPC_DB_RENAME_KEY
#define RPC_AL_TRIGGER_ALARM
#define RPC_DB_GET_NEXT_LINK
#define RPC_BM_SET_CACHE_SIZE
#define RPC_BM_CLOSE_ALL_BUFFERS
INT rpc_server_shutdown(void)
#define RPC_DB_SET_LINK_DATA
int rpc_flush_event_socket(int timeout_msec)
#define RPC_DB_GET_LINK_DATA
#define RPC_DB_SET_DATA_INDEX1
#define RPC_DB_GET_PARENT
INT rpc_set_debug(void(*func)(const char *), INT mode)
#define RPC_DB_REORDER_KEY
#define RPC_DB_OPEN_DATABASE
#define RPC_DB_CHECK_RECORD
#define RPC_BM_RECEIVE_EVENT_CXX
#define RPC_BM_GET_BUFFER_LEVEL
#define RPC_DB_GET_DATA_INDEX
INT rpc_register_listener(int port, RPC_HANDLER func, int *plsock, int *pport)
#define RPC_BM_OPEN_BUFFER
#define RPC_DB_GET_KEY_INFO
#define RPC_BM_EMPTY_BUFFERS
INT rpc_server_accept(int lsock)
#define RPC_DB_FLUSH_DATABASE
#define RPC_CM_SET_WATCHDOG_PARAMS
#define RPC_BM_RECEIVE_EVENT
#define RPC_CM_MSG_RETRIEVE
#define RPC_BM_SKIP_EVENT
#define RPC_BM_INIT_BUFFER_COUNTERS
#define RPC_DB_GET_KEY_TIME
#define RPC_DB_SET_RECORD
#define RPC_DB_GET_RECORD_SIZE
#define RPC_BM_FLUSH_CACHE
#define RPC_DB_GET_OPEN_RECORDS
#define RPC_CM_GET_WATCHDOG_INFO
INT rpc_get_convert_flags(void)
void rpc_convert_single(void *data, INT tid, INT flags, INT convert_flags)
#define RPC_DB_CREATE_KEY
#define RPC_DB_GET_RECORD
BOOL debug
debug printouts
char expt_name[NAME_LENGTH]
INT bm_get_buffer_info(INT buffer_handle, BUFFER_HEADER *buffer_header)
bool ends_with_char(const std::string &s, char c)
INT bm_get_buffer_level(INT buffer_handle, INT *n_bytes)
std::string msprintf(const char *format,...)
INT bm_init_buffer_counters(INT buffer_handle)
static int test3_cxx(INT routine_id, void *prpc_param[])
static int test2_cxx(INT routine_id, void *prpc_param[])
static int test4_cxx(INT routine_id, void *prpc_param[])
struct callback_addr callback
INT rpc_server_dispatch(INT index, void *prpc_param[])
INT rpc_test(BYTE b, WORD w, INT i, float f, double d, BYTE *b1, WORD *w1, INT *i1, float *f1, double *d1)
void debug_print(const char *msg)
static int test2(INT routine_id, void *prpc_param[])
unsigned short host_port1
unsigned short host_port2
unsigned short host_port3