socket broadcast problem

Peter Mutsaers/100000 muts at fysaj.fys.ruu.nl
Tue Jun 12 18:20:19 AEST 1990


I am trying to use broadcasts on a socket to transport large amounts
of data to many computers on our ethernet the same time, but,
it seems that there are only some computers that I can broadcast from.
The other ones don't give errors, but the broadcasted data just never
arrives. The problem is on the sender side. I use computers with the
same OS (AIX 1.1), and some others (apollo etc.), it happens with
all of them.
Could I have forgotten something in the initialization I use? (see below),
or can it have something to do with the configuration of the computers
I use?


    sb= -1;
    if (sb<0) {
        sb=socket(AF_INET,SOCK_DGRAM,PF_UNSPEC);
        if (sb<0) {
            perror("opening datagram socket");
            exit(1);
        }
    }
    if (setsockopt(sb,SOL_SOCKET,SO_BROADCAST,&on,sizeof(on))<0) {
        perror ("setsockopt");
        exit (1);
    }
    bzero((char *)&name,sizeof(name));
    name.sin_family=AF_INET;
    name.sin_addr.s_addr=htonl(0xd383ffffL); /* were on subnet 131.211.xx.xx */
    name.sin_port=MYPORT;

I thought this initialization should be enough to do a broadcast using:
    
    sendto(sb,buf,sizeof(buf),0,&name,sizeof(name))


I would be helped much with remarks on this.
--
Peter Mutsaers                          email:    muts at fysaj.fys.ruu.nl     
Rijksuniversiteit Utrecht                         nmutsaer at ruunsa.fys.ruu.nl
Princetonplein 5                          tel:    (+31)-(0)30-534504
3584 CG Utrecht, Netherlands                                  



More information about the Comp.unix.wizards mailing list