ts-7000
[Top] [All Lists]

[ts-7000] udp broadcast doesn't work ?

To:
Subject: [ts-7000] udp broadcast doesn't work ?
From: Dave Cramer <>
Date: Fri, 20 Oct 2006 11:13:39 -0400
Any ideas why we can't send a udp broadcast message with the  
following code ?

int main( int arc, char *argv[])
{
         int flag=1;
         int sd;
         char testbuff[] = {"1234567890"};
         struct sockaddr_in bcast_addr;

         if ((sd =socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
         {
                 fprintf(stderr,"socket error\n");
                 exit(-1);
         }
         if ( setsockopt(sd,SOL_SOCKET,SO_BROADCAST,(char *) 
&flag,sizeof(flag)) < 0 )
         {
                 fprintf(stderr,"unable to set broadcast\n");
                 exit(-1);
         }
         memset( &bcast_addr,0,sizeof( struct sockaddr_in) );
         bcast_addr.sin_family = AF_INET;
         bcast_addr.sin_addr.s_addr = 0xffffffff;
         bcast_addr.sin_port=5433;
         if ( sendto( sd,testbuff, sizeof( testbuff),0,
                 ( const struct sockaddr * ) &bcast_addr,
                 sizeof( const struct sockaddr_in ) ) == -1)
         {
                 fprintf( stderr, "error sending\n");
                 exit(-1);
         }

         fprintf( stderr,"everything ok\n");


}


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
  • [ts-7000] udp broadcast doesn't work ?, Dave Cramer <=
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU