testclient.c 533 B

123456789101112131415161718192021222324
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <esl.h>
  4. int main(void)
  5. {
  6. esl_handle_t handle = {{0}};
  7. esl_connect(&handle, "localhost", 8021, NULL, "ClueCon");
  8. esl_send_recv(&handle, "api status\n\n");
  9. if (handle.last_sr_event && handle.last_sr_event->body) {
  10. printf("%s\n", handle.last_sr_event->body);
  11. } else {
  12. // this is unlikely to happen with api or bgapi (which is hardcoded above) but prefix but may be true for other commands
  13. printf("%s\n", handle.last_sr_reply);
  14. }
  15. esl_disconnect(&handle);
  16. return 0;
  17. }