Shows how to write a simple client (dialer that connects to the example server using ecore_con_server_connect().
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Con.h>
#include <Ecore_Getopt.h>
static int retval = EXIT_SUCCESS;
static char *starttls_local_command = NULL;
_setup_ssl(void)
{
   const char *ca;
     {
        retval = EXIT_FAILURE;
     }
   
     {
          fprintf(stderr, "WARNING: could not load CA: %s!\n", ca);
     }
   if (verify)
   if (hostname_verify)
}
{
   char *line = NULL;
#ifdef _WIN32
   char lbuf[4096] = "";
   ssize_t r;
   if (fgets(lbuf, sizeof(lbuf), stdin) == NULL)
     r = -1;
   else
     {
        line = strdup(lbuf);
        r = strlen(line);
     }
#else
   size_t len = 0;
   ssize_t r = getline(&line, &len, stdin);
#endif
   if (r < 0)
     {
        fprintf(stderr, "ERROR: could not read from stdin: %s\n", strerror(errno));
     }
   if (!svr)
     fputs("WARNING: not connected to server, ignored input.\n", stderr);
   else
     {
        size_t clen = strlen(starttls_local_command);
        if (do_ssl_upgrade && ((size_t)r > clen) &&
            (strncmp(line, starttls_local_command, clen) == 0) &&
            (line[clen] == '\n' || line[clen] == '\r'))
          {
             printf("INFO: starting SSL communication...\n");
               {
                  printf("ERROR: failed to upgrade to SSL!\n");
                  retval = EXIT_FAILURE;
               }
#if 1
             
             else if (!_setup_ssl())
               {
                  retval = EXIT_FAILURE;
               }
#endif
             svr = NULL; 
             goto end;
          }
        printf("INFO: sent %zd bytes to server.\n", r);
        if (single_message)
          {
             svr = NULL;
          }
     }
 end:
   free(line);
}
{
   if (do_ssl_upgrade)
     printf("INFO: Not sending 'hello!' in tcp+ssl mode. Use: %s to upgrade the connection\n", starttls_local_command);
   else
}
{
   svr = NULL;
}
{
   printf("Received %i bytes from server:\n"
          ">>>>>\n"
          "%.*s\n"
          ">>>>>\n",
}
{
   printf(
"Sent %d bytes to server\n", ev->
size);
}
{
   printf(
"Server Error: %s\n", ev->
error);
}
{
}
static const char *types_strs[] = {
  "tcp",
  "udp",
  "ssl",
  "tcp+ssl",
  "local-user",
  "local-system",
  NULL
};
  "ecore_con_client_example", 
  NULL, 
  "1", 
  "(C) 2016 Enlightenment Project; 2010 Mike Blumenkrantz", 
  "BSD 2-Clause", 
  
  "Example of ecore_con_server_connect()\n",
  {
    ECORE_GETOPT_STORE_STR(
'c', 
"starttls-local-command", 
"The string to use as a local command (it's NOT sent to remote peer) to upgrade connections when -t/--type=tcp+ssl. Defaults to STARTTLS, however if you need to send that to the server, change the string with this option."),
   }
};
int
main(int argc, char *argv[])
{
   char *name = NULL;
   char *type_choice = NULL;
   Ecore_Con_Type type;
   int port = -1;
     
     
   };
   int args;
   if (args < 0)
     {
        fputs("ERROR: Could not parse command line options.\n", stderr);
        retval = EXIT_FAILURE;
        goto end;
     }
   if (quit_option) goto end;
   if (args < 0)
     {
        fputs("ERROR: Could not parse positional arguments.\n", stderr);
        retval = EXIT_FAILURE;
        goto end;
     }
   if (!type_choice) type_choice = "tcp";
   if (strcmp(type_choice, "tcp") == 0)
     type = ECORE_CON_REMOTE_TCP;
   else if (strcmp(type_choice, "udp") == 0)
     type = ECORE_CON_REMOTE_UDP;
   else if (strcmp(type_choice, "ssl") == 0)
     type = ECORE_CON_REMOTE_TCP | ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT;
   else if (strcmp(type_choice, "tcp+ssl") == 0)
     {
        type = ECORE_CON_REMOTE_TCP;
     }
   else if (strcmp(type_choice, "local-user") == 0)
     type = ECORE_CON_LOCAL_USER;
   else if (strcmp(type_choice, "local-system") == 0)
     type = ECORE_CON_LOCAL_SYSTEM;
   else
     {
        fprintf(stderr, "ERROR: unsupported --type/-t '%s'\n", type_choice);
        retval = EXIT_FAILURE;
        goto end;
     }
   if ((!starttls_local_command) || (starttls_local_command[0] == '\0'))
     starttls_local_command = "STARTTLS";
   if (no_proxy) type |= ECORE_CON_NO_PROXY;
   if (!svr) goto end;
   if (strcmp(type_choice, "ssl") == 0)
     {
        if (!_setup_ssl())
          goto no_mainloop;
     }
 no_mainloop:
   if (svr)
     {
        svr = NULL;
     }
end:
   return retval;
}