This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Problem reading broadcast IP
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Emmanuel Coullien <coullien dot emmanuel at gmail dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 18 Jan 2008 10:32:22 +0100
- Subject: Re: [ECOS] Problem reading broadcast IP
- References: <3fae21000801180100s5a448e01v5da7c97978499b11@mail.gmail.com>
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