[ECOS] Problem with obtaining sockaddr from recvfrom()

Richard Pennington rich@pennware.com
Thu Oct 11 11:23:00 GMT 2007


jerzy dyrda wrote:
> Hello all,
> 
> I have problem with obtaining sockaddr from recvfrom() - function doesn't 
> return any socket address.
> 
> I do it in such way :
> 
> Socket is opened for UDP datagram :
>  fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
> 
> and bind to some port:
> 
> addr.sin_family = AF_INET;
> addr.sin_addr.s_addr = htonl(INADDR_ANY);
> addr.sin_port = htons(RMCP_UDP_PORT);
> rc = bind (fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
> 
> and next I'm waiting for a packet:
> ret = recvfrom(fd, &rmcp_packet_raw, IPMI_BUF_SIZE, 0,
> 					&remote_addr, &remote_addr_len);
> Received packet is correct according to length and contents but as I mention 
> in subject without a socket addres. It's confusing for me because the same 
> code works as Linux application. 
> 
> I'm using FreeBsd stack from version 2_0 of eCos
> 
> Any suggestion is appreciated.
> 
> Best regards,
> jerzy
> 
Not sure if this is your problem, but I have
#if defined(__ECOS)
     addr.sin_len = sizeof(addr);
#endif

in code that I use.

-Rich

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



More information about the Ecos-discuss mailing list