aboutsummaryrefslogtreecommitdiff
path: root/src/htmsocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/htmsocket.c')
-rw-r--r--src/htmsocket.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/htmsocket.c b/src/htmsocket.c
index d9d9343..36b1d1a 100644
--- a/src/htmsocket.c
+++ b/src/htmsocket.c
@@ -104,7 +104,7 @@ typedef struct
/* open a socket for HTM communication to given host on given portnumber */
/* if host is 0 then UNIX protocol is used (i.e. local communication */
-void *OpenHTMSocket(char *host, int portnumber)
+void *OpenHTMSocket(char *host, int portnumber, unsigned char multicast_TTL)
{
struct sockaddr_in cl_addr;
#ifndef WIN32
@@ -229,7 +229,12 @@ void *OpenHTMSocket(char *host, int portnumber)
// enable broadcast: jdl ~2003
if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) {
- perror("setsockopt");
+ perror("setsockopt broadcast");
+ }
+
+ // set multicast Time-To-Live: ss
+ if(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &multicast_TTL, sizeof(multicast_TTL)) == -1) {
+ perror("setsockopt TTL");
}
if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) {
@@ -253,6 +258,11 @@ void *OpenHTMSocket(char *host, int portnumber)
perror("setsockopt");
}
+ // set multicast Time-To-Live: ss 2006
+ if(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &multicast_TTL, sizeof(multicast_TTL)) == -1) {
+ perror("setsockopt TTL");
+ }
+
if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) {
perror("could not bind\n");
close(sockfd);