sending a packet to multiple client at a time from udp socket
Posted
by mawia
on Stack Overflow
See other posts from Stack Overflow
or by mawia
Published on 2010-05-11T16:16:19Z
Indexed on
2010/05/11
16:34 UTC
Read the original article
Hit count: 225
socket-programming
Hi! all, I was trying to write a udp server who send an instance of a file to multiple clients.Now suppose any how I manage to know the address of those client statically(for the sake of simplicity) and now I want to send this packet to these addresses.So how exactly I need to fill the sockaddr structure to contain the address of these clients.I am taking an array of sockaddr structure(to contain client address) and trying to send at each one them at a time.Now problem is to fill the individual sockaddr structure to contain the client address. I was trying to do something like that
sa[1].sin_family = AF_INET;
sa[1].sin_addr.s_addr = htonl(INADDR_ANY);//should'nt I replace this INADDR_ANY with client ip??
sa[1].sin_port = htons(50002);
Correct me if this is not the correct way. All your help in this regard will be highly appreciated.
With Thanks in advance,
Mawia
© Stack Overflow or respective owner