addr.sin_port =
htons(50050);
addr.sin_addr.s_addr = htonl(
(239<<24)|(255<<16)|(255<<8)|(250)); /* be sure of your byte-order
*/
err = sendto( sock, "Hello", 5, 0, (struct sockaddr *)&addr, sizeof(
addr));
closesocket(
sock);
Hi
Julian,
You
should got a "internal" (since it doesn't seems to return a error code) during
the bind operation, since you try to bind your sock to a multicast address
(which is a wrong idea).
If
you only need to send mutlicast, you can bind to any addr/port, like
this:
addr.sin_family = AF_INET;
addr.sin_port =
htons(INADDR_ANY);
addr.sin_addr.s_addr =
htonl(INADDR_ANY);
and
next, change the IP address to the multicast group you
want.
addr.sin_addr.s_addr =
htonl( (239<<24)|(255<<16)|(255<<8)|(250)); /* be sure of your byte-order
*/
Regards
====================================
Frédéric
BERNON
HYMATOM SA
Chef de projet informatique
Microsoft
Certified Professional
Tél. : +33
(0)4-67-87-61-10
Fax. : +33
(0)4-67-70-85-44
Email : address@hiddenr
Web Site : http://www.hymatom.fr
====================================
P
Avant
d'imprimer, penser à l'environnement
I have a small problem and cant work out what i am doing
wrong.
I have stripped out the code to this and this hangs in
udp_sendto waiting on a mbox
int sock;
int >int
err;
struct sockaddr_in
addr;
memset(&addr, 0,
sizeof(addr));
addr.sin_family
=
AF_INET;
addr.sin_addr.s_addr
= htonl(
(239<<24)|(255<<16)|(255<<8)|(250));
addr.sin_port =
50050;
sock =
socket(PF_INET, SOCK_DGRAM, 0);
// err = setsockopt(
sock, SOL_SOCKET, SO_REUSEADDR, (char *) &onBool, sizeof
(int));
err = bind( sock,
(struct sockaddr *)&addr, sizeof(struct
sockaddr));
err = sendto(
sock, "Hello", 5, 0, (struct sockaddr *)&addr, sizeof(
addr));
closesocket(
sock);
Any ideas, as i get no errors, also port 239.255.255.250 is
opened as multicast but i am not even getting data to be passed to the
ethernet
chip.
joolz