forked from enlightenment/efl
parent
f617346761
commit
cacf61712d
|
@ -6,13 +6,12 @@
|
||||||
* 2010 Mike Blumenkrantz
|
* 2010 Mike Blumenkrantz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* uncomment if using gnutls
|
/* comment if not using gnutls */
|
||||||
static void
|
static void
|
||||||
tls_log_func(int level, const char *str)
|
tls_log_func(int level, const char *str)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "|<%d>| %s", level, str);
|
fprintf(stderr, "|<%d>| %s", level, str);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
_add(void *data, int type, Ecore_Con_Event_Server_Add *ev)
|
_add(void *data, int type, Ecore_Con_Event_Server_Add *ev)
|
||||||
|
@ -20,7 +19,6 @@ _add(void *data, int type, Ecore_Con_Event_Server_Add *ev)
|
||||||
printf("Server with ip %s connected!\n", ecore_con_server_ip_get(ev->server));
|
printf("Server with ip %s connected!\n", ecore_con_server_ip_get(ev->server));
|
||||||
ecore_con_server_send(ev->server, "hello!", 6);
|
ecore_con_server_send(ev->server, "hello!", 6);
|
||||||
ecore_con_server_flush(ev->server);
|
ecore_con_server_flush(ev->server);
|
||||||
ecore_con_server_del(ev->server);
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +28,7 @@ Eina_Bool
|
||||||
_del(void *data, int type, Ecore_Con_Event_Server_Del *ev)
|
_del(void *data, int type, Ecore_Con_Event_Server_Del *ev)
|
||||||
{
|
{
|
||||||
printf("Lost server with ip %s!\n", ecore_con_server_ip_get(ev->server));
|
printf("Lost server with ip %s!\n", ecore_con_server_ip_get(ev->server));
|
||||||
|
ecore_main_loop_quit();
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +53,9 @@ int main()
|
||||||
ecore_init();
|
ecore_init();
|
||||||
ecore_con_init();
|
ecore_con_init();
|
||||||
|
|
||||||
/* uncomment if using gnutls
|
/* comment if not using gnutls */
|
||||||
gnutls_global_set_log_level(9);
|
gnutls_global_set_log_level(9);
|
||||||
gnutls_global_set_log_function(tls_log_func);
|
gnutls_global_set_log_function(tls_log_func);
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */
|
/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */
|
||||||
|
@ -68,8 +66,9 @@ int main()
|
||||||
ecore_con_server_connect(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL);
|
ecore_con_server_connect(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* to use simple tcp without ssl/tls, use this line */
|
/* to use simple tcp with ssl/tls, use this line */
|
||||||
ecore_con_server_connect(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL);
|
if (!ecore_con_server_connect(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_MIXED, "127.0.0.1", 5556, NULL))
|
||||||
|
exit(1);
|
||||||
|
|
||||||
/* set event handler for server connect */
|
/* 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)_add, NULL);
|
||||||
|
|
Loading…
Reference in New Issue