This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem reading broadcast IP


On Fri, Jan 18, 2008 at 10:00:56AM +0100, Emmanuel Coullien wrote:
> Hi,
> 
> I' am trying to get broadcast frame from Ethernet with the following code :
> 
> void Test_system_UDP2(void)
> {
>     int n_read;
>     struct timeval tv;
>     int srecept;
>     struct sockaddr_in srv_recept;
>     int FrameErrCountSocket1=0;
>     int DataErrCountSocket1=0;
> 	int RecvError=0;
>     int ErrSendSocket=0;
> 	int CountSocket1=0;
>     int i;
>     unsigned char j;
>     int StartCycle =1;
>     /* for select on socket */
>     int ret;
>     fd_set file_set;
> 
> 	int FlgON = 1;   // Utiliser pour activer des Options dans SetSockOpt
> 	
>     /*** Init de la socket de reception ***/
>     bzero(&srv_recept, sizeof(srv_recept));
>     srv_recept.sin_family = AF_INET;
>     srv_recept.sin_port = htons(PORT_TO_SEND);
> //    srv_recept.sin_addr.s_addr=INADDR_ANY;
>     srv_recept.sin_addr.s_addr=inet_addr("192.168.1.3");

Just a guess, but try binding to the broadcast address on that
interface, not the interface address itself.

> I tried on a PC and I haven't any problem with
> srv_recept.sin_addr.s_addr=inet_addr("192.168.1.3");. I received the
> broadcast frame.

A PC runing FreeBSD? 

  Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]