diff options
author | jdl <x75@users.sourceforge.net> | 2003-05-27 19:13:43 +0000 |
---|---|---|
committer | jdl <x75@users.sourceforge.net> | 2003-05-27 19:13:43 +0000 |
commit | 1e199f2d181d2aaedffc3e95cf7a18c3a25180eb (patch) | |
tree | 6628f0df1335da364f4f8472451aa0e366d21bb3 /send+dump/htmsocket.c | |
parent | f8290b0742c16a3a4d2ac12c97984e8b6f452a69 (diff) |
added broadcast socket option to htmsocket
svn path=/trunk/externals/OSCx/; revision=660
Diffstat (limited to 'send+dump/htmsocket.c')
-rw-r--r-- | send+dump/htmsocket.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/send+dump/htmsocket.c b/send+dump/htmsocket.c index cb00d4f..34e3f2c 100644 --- a/send+dump/htmsocket.c +++ b/send+dump/htmsocket.c @@ -85,6 +85,7 @@ typedef struct void *OpenHTMSocket(char *host, int portnumber) { int sockfd; + int oval = 1; struct sockaddr_in cl_addr; struct sockaddr_un ucl_addr; desc *o; @@ -126,7 +127,7 @@ void *OpenHTMSocket(char *host, int portnumber) mkstemp(ucl_addr.sun_path); clilen = sizeof(ucl_addr.sun_family) + strlen(ucl_addr.sun_path); - + if (bind(sockfd, (struct sockaddr *) &ucl_addr, clilen) < 0) { perror("client: can't bind local address"); @@ -183,6 +184,10 @@ void *OpenHTMSocket(char *host, int portnumber) cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); cl_addr.sin_port = htons(0); + if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { + perror("setsockopt"); + } + if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { perror("could not bind\n"); |