Next: , Previous: Tutorial, Up: Tutorial

7.1 Connecting and sending commands to listserv

The connection is initialized with listserv_init and data is freed with listserv_destroy. Commands are sent with listserv_command.

liblistserv opens a new TCP connection on each command. But listserv_init and listserv_destroy have to be called just once.

Let's send the command "GET default.mailtpl".

       struct listserv *l = listserv_init (NULL, NULL, NULL);
       printf ("The result of 'GET default.mailtpl' is: %s\n",
       listserv_command (l, "GET default.mailtpl"));
       listserv_destroy (l);

That's all. Details about the functions parameters are provided in the reference for the respective function.

For the following sections in this manual it will be assumed that the variable l contains the return value of listserv_init.