--- /dev/null
+#include <stdio.h>
+#include <Ecore.h>
+#include <Ecore_Con.h>
+
+/* Ecore_Con client example
+ * 2010 Mike Blumenkrantz
+ */
+
+#define NUM_CLIENTS 10000
+
+static Eina_Counter *counter;
+static int add = 0;
+static int del = 0;
+
+Eina_Bool
+_add(void *data, int type, Ecore_Con_Event_Server_Add *ev)
+{
+ ++add;
+ printf("Connection #%i!\n", add);
+ if (add == NUM_CLIENTS)
+ ecore_main_loop_quit();
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+Eina_Bool
+_del(void *data, int type, Ecore_Con_Event_Server_Add *ev)
+{
+ ++del;
+ printf("Connection lost! #%i!\n", del);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_spawn(void *data)
+{
+ int x;
+
+ for (x = 0; x < NUM_CLIENTS; x++)
+ {
+// printf("Creating connection %i\n", x);
+ if (!ecore_con_server_connect(ECORE_CON_REMOTE_NODELAY, "127.0.0.1", 8080, NULL))
+ {
+ printf("CRITICAL ERROR!\n");
+ exit(1);
+ }
+ }
+ printf("***Job done***\n");
+}
+
+int main(void)
+{
+ double done;
+ eina_init();
+ ecore_init();
+ ecore_con_init();
+
+ eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR);
+ counter = eina_counter_new("client");
+ eina_counter_start(counter);
+ done = ecore_time_get();
+
+ ecore_job_add(_spawn, NULL);
+
+/* set event handler for server connect */
+ ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL);
+ ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_del, NULL);
+
+/* start client */
+ ecore_main_loop_begin();
+ eina_counter_stop(counter, 1);
+ printf("\nTime elapsed for %i connections: %f seconds\n%s", NUM_CLIENTS, ecore_time_get() - done, eina_counter_dump(counter));
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <Ecore.h>
+#include <Ecore_Con.h>
+
+/* Ecore_Con server example
+ * 2010 Mike Blumenkrantz
+ */
+
+static Ecore_Con_Server *svr;
+static int add;
+static int del;
+
+Eina_Bool
+_add(void *data, int type, Ecore_Con_Event_Client_Add *ev)
+{
+ ++add;
+// printf ("%s ", ecore_con_client_ip_get(ev->client));
+ printf("Client #%i!\n", add);
+ return ECORE_CALLBACK_RENEW;
+}
+
+Eina_Bool
+_del(void *data, int type, Ecore_Con_Event_Client_Del *ev)
+{
+ ++del;
+// printf("Disconnected #%i!\n", del);
+ if (add == del)
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_RENEW;
+}
+
+int main(int argc, const char *argv[])
+{
+ ecore_init();
+ ecore_con_init();
+ ecore_app_args_set(argc, argv);
+ eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR);
+
+
+/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */
+// if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL)))
+
+/* to use simple tcp with ssl/tls, use this line */
+ svr = ecore_con_server_add(ECORE_CON_REMOTE_NODELAY , "127.0.0.1", 8080, NULL);
+ if (!svr)
+ exit(1);
+
+ ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL);
+ ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL);
+
+/* start server */
+ ecore_main_loop_begin();
+ if (add && del)
+ {
+ printf("Restarting server after %i connections\n", add);
+ add = del = 0;
+ ecore_con_server_del(svr);
+ ecore_app_restart();
+ }
+ return 0;
+}