The following is an XIO example code I found in Internet.
Can anyone please show me how to execute it under GT4.2.1 ?
I enter (line 17,18)
17 contact_string = "file:/etc/group";
18 driver_name = "file";
It is not work! (stop in line 36)
1 #include "globus_xio.h"
2
3 int
4 main(
5 int argc,
6 char * argv[])
7 {
8 globus_result_t res;
9 char * driver_name;
10 globus_xio_driver_t driver;
11 globus_xio_stack_t stack;
12 globus_xio_handle_t handle;
13 globus_size_t nbytes;
14 char * contact_string = NULL;
15 char buf[256];
16
17 contact_string = argv[1];
18 driver_name = argv[2];
19
20 globus_module_activate(GLOBUS_XIO_MODULE);
21 res = globus_xio_driver_load(
22 driver_name,
23 &driver);
24 assert(res == GLOBUS_SUCCESS);
25
26 res = globus_xio_stack_init(&stack, NULL);
27 assert(res == GLOBUS_SUCCESS);
28 res = globus_xio_stack_push_driver(stack, driver);
29 assert(res == GLOBUS_SUCCESS);
30
31 res = globus_xio_handle_create(&handle, stack);
32 assert(res == GLOBUS_SUCCESS);
33
34 globus_xio_attr_t attr;
35 globus_xio_attr_init(&attr);
36 res = globus_xio_open(handle, contact_string, attr);
37 assert(res == GLOBUS_SUCCESS);
38
39 do
40 {
41 res = globus_xio_read(handle, buf, sizeof(buf) - 1, 1,
&nbytes, NULL);
42 if(nbytes > 0)
43 {
44 buf[nbytes] = '\0';
45 fprintf(stderr, "%s", buf);
46 }
47 } while(res == GLOBUS_SUCCESS);
48
49 globus_xio_close(handle, NULL);
50
51 globus_module_deactivate(GLOBUS_XIO_MODULE);
52
53 return 0;
54 }
55