You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/11/15 09:31:05 UTC
svn commit: r1202088 - in /commons/sandbox/runtime/trunk/src/main/native/os:
unix/sockopts.c win32/sockopts.c
Author: mturk
Date: Tue Nov 15 08:31:04 2011
New Revision: 1202088
URL: http://svn.apache.org/viewvc?rev=1202088&view=rev
Log:
Implement SO_BROADCAST in native
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c?rev=1202088&r1=1202087&r2=1202088&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/sockopts.c Tue Nov 15 08:31:04 2011
@@ -187,6 +187,17 @@ ACR_NET_EXPORT(jint, SocketDescriptor, o
/* Set numeric values */
switch (opt) {
+ case ACR_OPT_SO_BROADCAST:
+#if defined(SO_BROADCAST)
+ if (on != ACR_HASFLAG(fd, ACR_SO_BROADCAST)) {
+ if (setsockopt(fd->s, SOL_SOCKET, SO_BROADCAST, (void *)&on, SSIZEOF(int)) != 0)
+ return ACR_GET_NETOS_ERROR();
+ ACR_PUTFLAG(fd, ACR_SO_BROADCAST, on);
+ }
+#else
+ rc = ACR_ENOTIMPL;
+#endif
+ break;
case ACR_OPT_SO_KEEPALIVE:
#if defined(SO_KEEPALIVE)
if (on != ACR_HASFLAG(fd, ACR_SO_KEEPALIVE)) {
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c?rev=1202088&r1=1202087&r2=1202088&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/sockopts.c Tue Nov 15 08:31:04 2011
@@ -139,6 +139,17 @@ ACR_NET_EXPORT(jint, SocketDescriptor, o
/* Set numeric values */
switch (opt) {
+ case ACR_OPT_SO_BROADCAST:
+#if defined(SO_BROADCAST)
+ if (on != ACR_HASFLAG(fd, ACR_SO_BROADCAST)) {
+ if (setsockopt(fd->s, SOL_SOCKET, SO_BROADCAST, (void *)&on, SSIZEOF(int)) != 0)
+ return ACR_GET_NETOS_ERROR();
+ ACR_PUTFLAG(fd, ACR_SO_BROADCAST, on);
+ }
+#else
+ rc = ACR_ENOTIMPL;
+#endif
+ break;
case ACR_OPT_SO_KEEPALIVE:
if (on != ACR_HASFLAG(fd, ACR_SO_KEEPALIVE)) {
if (setsockopt(fd->s, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, SSIZEOF(int)) != 0)