Commit Graph

11 Commits

Author SHA1 Message Date
Xavi Artigas 679c89d98d Adapt to latest event names 2019-03-09 15:54:38 +01:00
Mike Blumenkrantz fabab68024 merge all files from efl.git/src/examples 2018-08-09 17:39:17 -04:00
Mike Blumenkrantz d9bc92888a examples 2018-08-09 16:21:58 -04:00
Cedric BAIL 35395d4b3c ecore: remove use of efl_main_loop_get from efl_net_dialer_udp_example. 2018-01-09 16:29:30 -08:00
Carsten Haitzler ddf7587449 efl loop - rename ecore_main_loop_get to efl_main_loop_get
ecore_main_loop_get() is really a new "eo api" but it's using our old
ecore_* namespace, so move to the new efl namespace.
2018-01-02 16:13:54 +09:00
Gustavo Sverzut Barbieri 54de9e211f efl_net_dialer_udp_example: add missing print of groups. 2016-10-26 12:24:48 -02:00
Gustavo Sverzut Barbieri d4c6db251a efl_net_*_udp: make UDP usable, including multicast.
This was a huge work, but now UDP is usable as seen in the examples.

Instead of relying on 'connect()', just do 'sendto()' and 'recvfrom()'
as they are universal. Multicast address can only be connected in
IPv4, IPv6 wasn't working and I'm not sure the IPv4 is portable to
other platforms.

Dialer will auto-join multicast groups is the dialed address is
one. Multicast properties such as time to live (hops) and loopback can
be configured. When joining multicast groups, the local
address/interface can be configured by 'IP@IFACE' format, with
'@IFACE' being optional.

Dialers will now auto-bind, so it can receive data as dialers are
expected to be bi-directional. One can manually specify the binding
address if there is such need.

Since datagrams must be read in their full size, otherwise the
remaining bits are dropped, expose next_datagram_size_query() in both
Efl.Net.Socket.Udp and Efl.Net.Server.Udp.Client.

To finalize UDP for real we need to introduce an 'Efl_Net_Ip_Address'
structure to serve as both IPv4 and IPv6 and expose 'sendto()' and
'recvfrom()'. These will come later as this commit is already too big.
2016-10-25 10:11:48 -02:00
Gustavo Sverzut Barbieri b71a7a6a58 efl_* examples: improve usability of boolean options.
Instead of using 'bool', which requires a parameter to be useful, make
them toggle of the default value.

Adapt names to make more sense in that context.
2016-10-22 11:55:45 -02:00
Gustavo Sverzut Barbieri 38502d2df4 efl_net_*_udp: expose SO_DONTROUTE.
It's common to have protocols that are restricted to local network
only, thus allow exposing SO_DONTROUTE to avoid mistakes.
2016-10-22 11:46:19 -02:00
Gustavo Sverzut Barbieri dd1c574b86 efl_net_dialer_udp_example: be more 'correct' using events to read/write.
instead of blindly reading and writing, which can lead to hangs due no
server, let's use can_read and can_write to do the operations, this
won't let us believe we can read when we can't.

it's also the recommended approach, so let's show that in the examples
so users don't copy&paste incorrect stuff :-)
2016-10-21 13:33:27 -02:00
Gustavo Sverzut Barbieri b36e2c65f6 efl_net_dialer_udp: "connect" to an UDP server to send and receive data.
Like existing ecore_con code, this does not use SOCKSv5 UDP
proxy. It's kinda cumbersome to add since requires a keep alive TCP
connection to the server, a second UDP channel and framing around the
original UDP frame.

Added UDP_CORK (if present) to match TCP_UDP present in TCP sockets,
this allows one to execute multiple write() calls that will result in
a single datagram, generated when CORK becomes FALSE again.

The efl_io_copier_example.c now accepts this as output. There is no
input UDP as there is no way to notify the server of a connection
(since such thing doesn't exit), usually servers react after a
datagram is received, replying to the source.
2016-10-18 19:04:00 -02:00