#include <fcntl.h>
int main(int argc, char *argv[]) {
- int send_fd;
+ int send_fd,broadcast_on;
struct sockaddr_in local_addr, remote_addr;
socklen_t remote_addr_len,optlen;
int send_bytes, read_bytes;
exit(1);
}
- optlen=1;
- if((setsockopt(send_fd,SOL_SOCKET,SO_BROADCAST,NULL,optlen))==-1)
+ broadcast_on=1;
+ optlen=sizeof(broadcast_on);
+ if((setsockopt(send_fd,SOL_SOCKET,SO_BROADCAST,&broadcast_on,optlen))==-1)
perror("setsockopt");