On Mon, 19 Jun 2000 15:57:58 GMT, "Øyvind Holmeide" <oeyvind.holmeide@no.abb.com> wrote:
I am trying to use UDP multicast in VxWorks without success. I have used >the sample code from WindRiver, see below, but the sendto() command fails >with errno = 0x41. Any hints?
<snip>
/* sin.sa_len = (u_char) sizeof(sin); */
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(0);
if (bind(sockDesc, (struct sockaddr *)&sin, sizeof(sin)) != 0)
perror("bind");
if (sockDesc)
close (sockDesc);
return (ERROR);
}
At this point in my initialization I configure the interface for
multicast, with somethin like :
setsockopt(send_socket,
IPPROTO_IP,
IP_MULTICAST_IF,
(char *)&sin.sin_addr.s_addr,
sizeof(sin.sin_addr.s_addr));
Then set TTL if there are any routers in that the message must
go through.
I am using 5.3.1 with the SENS and SENS upgrade patches applied.
toAddrLen = sizeof(struct sockaddr_in);
/* toAddr.sa_len = (u_char) toAddrLen; */
toAddr.sin_family = AF_INET;
/* initialize the address to the send */
toAddr.sin_addr.s_addr = inet_addr (mcastAddr);
/* initialize the port to send */
toAddr.sin_port = htons(mcastPort);
bufPtr = sendBuf; /* initialize the buffer pointer */
/* send the buffer */
while (sendLen > 0)
if ((len = sendto (sockDesc, bufPtr, sendLen, 0,
(struct sockaddr *)&toAddr, toAddrLen)) < 0 )
printf("mcastSend sendto errno:0x%x\n", errno );
break;
}
sendLen -= len;
bufPtr += len;
taskDelay (1); /* give a taskDelay */
}
if (sockDesc != ERROR)
close (sockDesc);
return (OK);
}
================================================Dear All,
Bob DeJoie
Kwajalein Missile Range
Republic of the Marshall Islands
email: rjdejoie@kmrmail.kmr.ll.mit.edu
phone: 805-355-5855 fax: 805-355-3833
Time Zone: GMT +12 hours ================================================
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 353 |
Nodes: | 16 (2 / 14) |
Uptime: | 76:00:44 |
Calls: | 7,639 |
Files: | 12,802 |
Messages: | 5,691,804 |