Пример #1
0
void
test_searpc__initialize (void)
{
    searpc_server_init (register_marshals);
    searpc_create_service ("test");
    searpc_server_register_function ("test", get_substring, "get_substring",
                                     searpc_signature_string__string_int());
    searpc_server_register_function ("test", get_maman_bar, "get_maman_bar",
                                     searpc_signature_object__string());
    searpc_server_register_function ("test", get_maman_bar_list, "get_maman_bar_list",
                                     searpc_signature_objlist__string_int());
    searpc_server_register_function ("test", simple_json_rpc, "simple_json_rpc",
                                     searpc_signature_json__string_int());
    searpc_server_register_function ("test", count_json_kvs, "count_json_kvs",
                                     searpc_signature_json__json());

    /* sample client */
    client = searpc_client_new();
    client->send = sample_send;
    client->arg = "test";

    client->async_send = sample_async_send;
    client->async_arg = "test_async";

    SearpcNamedPipeServer *pipe_server = searpc_create_named_pipe_server(pipe_path);
    cl_must_pass_(searpc_named_pipe_server_start(pipe_server), "named pipe server failed to start");
#if defined(WIN32)
    // Wait for the server thread to start
    Sleep(1000);
#endif

    client_with_pipe_transport = do_create_client_with_pipe_transport();
}
Пример #2
0
void
test_searpc__initialize (void)
{
#if !GLIB_CHECK_VERSION(2, 36, 0)
    g_type_init ();
#endif
    searpc_server_init (register_marshals);
    searpc_create_service ("test");
    searpc_server_register_function ("test", get_substring, "get_substring", 
                                     searpc_signature_string__string_int());
    searpc_server_register_function ("test", get_maman_bar, "get_maman_bar", 
                                     searpc_signature_object__string());
    searpc_server_register_function ("test", get_maman_bar_list, "get_maman_bar_list", 
                                     searpc_signature_objlist__string_int());

    /* sample client */
    client = searpc_client_new();
    client->send = sample_send;
    client->arg = "test";

    client->async_send = sample_async_send;
    client->async_arg = "test_async";
}