Ecore Connection Client Functions

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Functions
Ecore Connection Client Functions
Ecore » Ecore_Con - Connection functions

Functions to communicate with and/or set options on a client. More...

## Functions
EAPI int | ecore_con_client_send (Ecore_Con_Client *cl, const void *data, int size)
| Send the given data to the given client. More...
static EOLIAN int | _ecore_con_client_ecore_con_base_send (Eo *obj, Ecore_Con_Client_Data *cl, const void *data, int size)
static EOLIAN Ecore_Con_Server * | _ecore_con_client_server_get (Eo *obj, Ecore_Con_Client_Data *cl)
static EOLIAN Eina_Bool | _ecore_con_client_ecore_con_base_connected_get (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI Eina_Bool | ecore_con_client_connected_get (const Ecore_Con_Client *cl)
| Return whether the client is still connected. More...
static EOLIAN void | _ecore_con_client_ecore_con_base_timeout_set (Eo *obj, Ecore_Con_Client_Data *cl, double timeout)
EAPI void | ecore_con_client_timeout_set (Ecore_Con_Client *cl, double timeout)
| Set the time after which the client will be disconnected when inactive. More...
static EOLIAN double | _ecore_con_client_ecore_con_base_timeout_get (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI double | ecore_con_client_timeout_get (const Ecore_Con_Client *cl)
| Get the default time after which the client will be disconnected when inactive. More...
EAPI void * | ecore_con_client_del (Ecore_Con_Client *cl)
| Close the connection and free memory allocated to the given client. More...
EAPI void | ecore_con_client_data_set (Ecore_Con_Client *cl, const void *data)
| Set the data associated with the given client to `data`. More...
EAPI void * | ecore_con_client_data_get (Ecore_Con_Client *cl)
| Retrieve the data associated with the given client. More...
static EOLIAN const char * | _ecore_con_client_ecore_con_base_ip_get (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI const char * | ecore_con_client_ip_get (const Ecore_Con_Client *cl)
| Get the IP address of a client that has connected. More...
static EOLIAN int | _ecore_con_client_ecore_con_base_port_get (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI int | ecore_con_client_port_get (const Ecore_Con_Client *cl)
| Return the port that the client has connected to. More...
static EOLIAN double | _ecore_con_client_ecore_con_base_uptime_get (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI double | ecore_con_client_uptime_get (const Ecore_Con_Client *cl)
| Check how long a client has been connected. More...
static EOLIAN void | _ecore_con_client_ecore_con_base_flush (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI void | ecore_con_client_flush (Ecore_Con_Client *cl)
| Flush all pending data to the given client. More...
EAPI int | ecore_con_server_fd_get (const Ecore_Con *obj)
| Get the fd that the server is connected to. More...
static EOLIAN int | _ecore_con_server_ecore_con_base_fd_get (Eo *obj, Ecore_Con_Server_Data *svr)
static EOLIAN int | _ecore_con_client_ecore_con_base_fd_get (Eo *obj, Ecore_Con_Client_Data *cl)
EAPI int | ecore_con_client_fd_get (const Ecore_Con *obj)
| Get the fd that the client is connected to. More...
EAPI int | ecore_ipc_ssl_available_get (void)
| Returns if SSL support is available. More...

## Detailed Description

Functions to communicate with and/or set options on a client.

Functions that operate on Ecore connection client objects.

This set of functions, as explained in Ecore Connection Server Functions, is used to send data to a client, or to set options and get information about this client. Most of them should be used on the server, applied on the client object.

If you need to implement a client, the way to connect to a server is described in Ecore Connection Server Functions.

An example of usage of these functions can be found at:

- Ecore_Con - Creating a client

## Function Documentation

EAPI int ecore_con_client_send | ( | Ecore_Con_Client * | cl,
|  | const void * | data,
|  | int | size
| ) |  |

Send the given data to the given client.

Parameters

  cl | The given client.
  data | The given data.
  size | Length of the data, in bytes, to send.

Returns
  The number of bytes sent. `0` will be returned if there is an error.

This function will send the given data to the client as soon as the program is back to the main loop. Thus, this function returns immediately (non-blocking). If the data needs to be sent now, call ecore_con_client_flush() after this one.

See also
  ecore_con_server_send()
  ecore_con_client_flush()

Examples:
  ecore_con_server_example.c, and ecore_con_server_simple_example.c.

References ECORE_CON_REMOTE_CORK, ECORE_CON_REMOTE_UDP, ECORE_FD_READ, ECORE_FD_WRITE, ecore_main_fd_handler_active_set(), eina_binbuf_append_length(), eina_binbuf_new(), eo_data_scope_get(), and ERR.

Referenced by ecore_ipc_client_send().

EAPI Eina_Bool ecore_con_client_connected_get | ( | const Ecore_Con_Client * | cl | ) |

Return whether the client is still connected.

Parameters

  cl | The given client.

Returns
  `EINA_TRUE` if connected, `EINA_FALSE` otherwise.

Examples:
  ecore_con_server_simple_example.c.

Referenced by ecore_ipc_client_send().

EAPI void ecore_con_client_timeout_set | ( | Ecore_Con_Client * | cl,
|  | double | timeout
| ) |  |

Set the time after which the client will be disconnected when inactive.

Parameters

  cl | The client object
  timeout | The timeout, in seconds, to disconnect after

This function is used by the server to set the idle timeout on a specific client. If the client becomes idle for a time higher than this value, it will be disconnected. A value of < 1 disables the idle timeout.

This timeout is not affected by the one set by ecore_con_server_timeout_set(). A client will be disconnected whenever the client or the server timeout is reached. That means, the lower timeout value will be used for that client if ecore_con_server_timeout_set() is used on the server.

See also
  ecore_con_client_timeout_get()
  ecore_con_server_timeout_set()

Examples:
  ecore_con_server_example.c, and ecore_con_server_simple_example.c.

EAPI double ecore_con_client_timeout_get | ( | const Ecore_Con_Client * | cl | ) |

Get the default time after which the client will be disconnected when inactive.

Parameters

  cl | The client object

Returns
  The timeout, in seconds, to disconnect after

This function is used to get the idle timeout for a client. A value of < 1 means the idle timeout is disabled.

See also
  ecore_con_client_timeout_set()

EAPI void * ecore_con_client_del | ( | Ecore_Con_Client * | cl | ) |

Close the connection and free memory allocated to the given client.

Parameters

  cl | The given client.

Returns
  Data associated with the client.

Examples:
  ecore_con_server_simple_example.c.

References eo_data_scope_get().

Referenced by ecore_con_client_fd_get(), and ecore_ipc_client_del().

EAPI void ecore_con_client_data_set | ( | Ecore_Con_Client * | cl,
|  | const void * | data
| ) |  |

Set the data associated with the given client to `data`.

Parameters

  cl | The given client.
  data | What to set the data to.

Examples:
  ecore_con_server_simple_example.c.

References eo_data_scope_get().

Referenced by ecore_ipc_ssl_available_get().

EAPI void * ecore_con_client_data_get | ( | Ecore_Con_Client * | cl | ) |

Retrieve the data associated with the given client.

Parameters

  cl | The given client.

Returns
  The data associated with `cl`.

Examples:
  ecore_con_server_simple_example.c.

References eo_data_scope_get().

Referenced by ecore_ipc_ssl_available_get().

EAPI const char * ecore_con_client_ip_get | ( | const Ecore_Con_Client * | cl | ) |

Get the IP address of a client that has connected.

Parameters

  cl | The given client.

Returns
  A pointer to an internal string that contains the IP address of the connected client in the form "XXX.YYY.ZZZ.AAA" IP notation.

The returned string should not be modified, freed or trusted to stay valid after deletion for the `cl` object. If no IP is known `NULL` is returned.

Examples:
  ecore_con_server_example.c, and ecore_con_server_simple_example.c.

References ECORE_CON_REMOTE_BROADCAST, ECORE_CON_REMOTE_MCAST, ECORE_CON_REMOTE_NODELAY, ECORE_CON_REMOTE_TCP, ECORE_CON_REMOTE_UDP, and eo_data_scope_get().

Referenced by ecore_ipc_client_ip_get().

EAPI int ecore_con_client_port_get | ( | const Ecore_Con_Client * | cl | ) |

Return the port that the client has connected to.

Parameters

  cl | The client

Returns
  The port that `cl` has connected to, or -1 on error Use this function to return the port on which a given client has connected.

Examples:
  ecore_con_server_simple_example.c.

References ecore_time_get().

EAPI double ecore_con_client_uptime_get | ( | const Ecore_Con_Client * | cl | ) |

Check how long a client has been connected.

Parameters

  cl | The client to check

Returns
  The total time, in seconds, that the client has been connected to the server

This function is used to find out how long a client has been connected for.

Examples:
  ecore_con_server_simple_example.c.

EAPI void ecore_con_client_flush | ( | Ecore_Con_Client * | cl | ) |

Flush all pending data to the given client.

Parameters

  cl | The given client.

This function will block until all data is sent to the server.

See also
  ecore_con_client_send()
  ecore_con_server_flush()

Examples:
  ecore_con_server_simple_example.c.

Referenced by ecore_ipc_client_flush().

EAPI int ecore_con_server_fd_get | ( | const Ecore_Con_Server * | svr | ) |

Get the fd that the server is connected to.

Parameters

  svr | The server object

Returns
  The fd, or -1 on failure

This function returns the fd which is used by the underlying server connection. It should not be tampered with unless you REALLY know what you are doing.

Note
  This function is only valid for servers created with ecore_con_server_connect()

Warning
  Seriously. Don't use this unless you know what you are doing.

Since
  1.1

References ecore_main_fd_handler_fd_get().

EAPI int ecore_con_client_fd_get | ( | const Ecore_Con_Client * | cl | ) |

Get the fd that the client is connected to.

Parameters

  cl | The client object

Returns
  The fd, or -1 on failure

This function returns the fd which is used by the underlying client connection. It should not be tampered with unless you REALLY know what you are doing.

Since
  1.1

References _Ecore_Con_Event_Client_Add::client, _Ecore_Con_Event_Client_Del::client, _Ecore_Con_Event_Client_Error::client, _Ecore_Con_Event_Client_Data::client, _Ecore_Con_Event_Client_Write::client, _Ecore_Con_Event_Client_Data::data, _Ecore_Con_Event_Server_Data::data, DBG, ECORE_CALLBACK_CANCEL, ECORE_CALLBACK_RENEW, ecore_con_client_del(), ECORE_CON_EVENT_CLIENT_ADD, ECORE_CON_EVENT_CLIENT_UPGRADE, ECORE_CON_EVENT_PROXY_BIND, ECORE_CON_EVENT_SERVER_ADD, ECORE_CON_EVENT_SERVER_UPGRADE, ECORE_CON_REMOTE_BROADCAST, ECORE_CON_REMOTE_CORK, ECORE_CON_REMOTE_MCAST, ECORE_CON_REMOTE_NODELAY, ECORE_CON_REMOTE_UDP, ecore_con_server_del(), ecore_event_add(), ecore_event_del(), ECORE_FD_READ, ECORE_FD_WRITE, ecore_main_fd_handler_active_get(), ecore_main_fd_handler_active_set(), ecore_main_fd_handler_add(), ecore_main_fd_handler_del(), ecore_time_get(), ecore_timer_add(), ecore_timer_del(), eina_binbuf_free(), eina_binbuf_length_get(), eina_binbuf_remove(), eina_binbuf_string_get(), EINA_FALSE, eina_list_append(), eina_list_data_find(), EINA_LIST_FREE, eina_list_remove(), eina_list_remove_list(), eina_stringshare_add(), eina_stringshare_del(), EINA_TRUE, eo_add, eo_data_scope_get(), eo_del(), ERR, _Ecore_Con_Event_Client_Error::error, _Ecore_Con_Event_Server_Error::error, fcntl(), INF, _Ecore_Con_Event_Proxy_Bind::ip, _Ecore_Con_Event_Proxy_Bind::port, _Ecore_Con_Event_Server_Add::server, _Ecore_Con_Event_Server_Del::server, _Ecore_Con_Event_Server_Error::server, _Ecore_Con_Event_Server_Data::server, _Ecore_Con_Event_Server_Write::server, _Ecore_Con_Event_Proxy_Bind::server, _Ecore_Con_Event_Data_Received::size, _Ecore_Con_Event_Client_Data::size, _Ecore_Con_Event_Server_Data::size, _Ecore_Con_Event_Client_Write::size, _Ecore_Con_Event_Server_Write::size, and WRN.

EAPI int ecore_ipc_ssl_available_get | ( | void |  | ) |

Returns if SSL support is available.

Returns
  1 if SSL is available, 0 if it is not.

References _Ecore_Ipc_Event_Client_Add::client, _Ecore_Ipc_Event_Client_Del::client, _Ecore_Ipc_Event_Client_Data::client, _Ecore_Con_Event_Client_Add::client, _Ecore_Con_Event_Client_Del::client, _Ecore_Con_Event_Client_Data::client, _Ecore_Ipc_Event_Client_Data::data, _Ecore_Ipc_Event_Server_Data::data, _Ecore_Con_Event_Client_Data::data, _Ecore_Con_Event_Server_Data::data, ECORE_CALLBACK_CANCEL, ECORE_CALLBACK_RENEW, ecore_con_client_data_get(), ecore_con_client_data_set(), ecore_con_server_data_get(), ecore_con_ssl_available_get(), ecore_event_add(), ecore_ipc_client_del(), ecore_ipc_server_del(), EINA_FALSE, eina_list_append(), eina_list_data_find(), EINA_TRUE, EINA_UNUSED, _Ecore_Ipc_Event_Client_Data::major, _Ecore_Ipc_Event_Server_Data::major, _Ecore_Ipc_Event_Client_Data::minor, _Ecore_Ipc_Event_Server_Data::minor, _Ecore_Ipc_Event_Client_Data::ref, _Ecore_Ipc_Event_Server_Data::ref, _Ecore_Ipc_Event_Client_Data::ref_to, _Ecore_Ipc_Event_Server_Data::ref_to, _Ecore_Ipc_Event_Client_Data::response, _Ecore_Ipc_Event_Server_Data::response, _Ecore_Ipc_Event_Server_Add::server, _Ecore_Ipc_Event_Server_Del::server, _Ecore_Ipc_Event_Server_Data::server, _Ecore_Con_Event_Server_Add::server, _Ecore_Con_Event_Server_Del::server, _Ecore_Con_Event_Server_Data::server, _Ecore_Ipc_Event_Client_Data::size, _Ecore_Ipc_Event_Server_Data::size, _Ecore_Con_Event_Client_Data::size, and _Ecore_Con_Event_Server_Data::size.