I have written a patch to add the possibility to send a broadcast with
Ecore_Con.
I suppose than we use a UDP socket to send a broadcast consequently the
modification is simple. But I don't have a lot of skills in network so maybe
this is not a correct way.
--
Regards.
Index: src/lib/ecore_con/Ecore_Con.h
===================================================================
--- src/lib/ecore_con/Ecore_Con.h (revision 41618)
+++ src/lib/ecore_con/Ecore_Con.h (working copy)
@@ -85,6 +85,7 @@
ECORE_CON_REMOTE_TCP,
ECORE_CON_REMOTE_MCAST,
ECORE_CON_REMOTE_UDP,
+ ECORE_CON_REMOTE_BROADCAST,
ECORE_CON_USE_SSL2 = (1 << 4),
ECORE_CON_USE_SSL3 = (1 << 5),
ECORE_CON_USE_TLS = (1 << 6)
Index: src/lib/ecore_con/ecore_con_info.c
===================================================================
--- src/lib/ecore_con/ecore_con_info.c (revision 41618)
+++ src/lib/ecore_con/ecore_con_info.c (working copy)
@@ -125,6 +125,8 @@
return ecore_con_info_get(svr, done_cb, data, &hints);
}
+
+
int
ecore_con_info_udp_listen(Ecore_Con_Server *svr,
Ecore_Con_Info_Cb done_cb,
Index: src/lib/ecore_con/ecore_con.c
===================================================================
--- src/lib/ecore_con/ecore_con.c (revision 41618)
+++ src/lib/ecore_con/ecore_con.c (working copy)
@@ -361,7 +361,7 @@
type = compl_type & ECORE_CON_TYPE;
- if ((type == ECORE_CON_REMOTE_TCP || type == ECORE_CON_REMOTE_UDP) && (port < 0)) return NULL;
+ if ((type == ECORE_CON_REMOTE_TCP || type == ECORE_CON_REMOTE_UDP || ECORE_CON_REMOTE_BROADCAST) && (port < 0)) return NULL;
if ((type == ECORE_CON_LOCAL_USER) || (type == ECORE_CON_LOCAL_SYSTEM) ||
(type == ECORE_CON_LOCAL_ABSTRACT))
@@ -457,7 +457,7 @@
/* TCP */
if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect, svr)) goto error;
}
- else if (type == ECORE_CON_REMOTE_UDP)
+ else if (type == ECORE_CON_REMOTE_UDP || type == ECORE_CON_REMOTE_BROADCAST)
{
/* UDP and MCAST */
if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, svr)) goto error;
@@ -1080,7 +1080,7 @@
{
Ecore_Con_Server *svr;
int curstate = 0;
-
+ int broadcast = 1;
svr = data;
if (!net_info) goto error;
@@ -1088,8 +1088,16 @@
if (svr->fd < 0) goto error;
if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
- if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0)
- goto error;
+
+ if(svr->type == ECORE_CON_REMOTE_BROADCAST)
+ {
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)) < 0) goto error;
+ }
+ else
+ {
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) goto error;
+ }
+
if (connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
goto error;
else
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel