0

I'm trying to create a BSD socket with RTEMS 5 in order to implement an UDP communication. I have the following function:

   #include <sys/socket.h>

   void Network_Initialization(void)
   {
     int fd;

     fd = socket(AF_INET, SOCK_DGRAM, 0);
     if(fd < 0 )
     {
       locked_printf("Cannot create a socket: %s \n", strerror(errno));
     }
   }

During execution the following error is returned:

Address family not supported by protocol family (106)

This code corresponds with EAFNOSUPPORT. I found this error for another funtions like bind(), but not for socket(). I supposed that is something related wiht RTEMS configuration... but what?

Thanks in advance

ferdepe
  • 510
  • 1
  • 6
  • 21
  • Can you please try to create a [Minimal, **Complete**, and Verifiable Example](http://stackoverflow.com/help/mcve), and show us? Are you 100% sure that the error comes from the code you show us? What else do your program do? Also, when showing us errors generated by your program, copy-paste it in full and complete. Don't try to shorten it down or otherwise edit it. Lastly, please [read about how to ask good questions](http://stackoverflow.com/help/how-to-ask). – Some programmer dude Jan 04 '18 at 08:39
  • http://pubs.opengroup.org/onlinepubs/9699919799/ says that _"[EAFNOSUPPORT] The implementation does not support the specified address family."_ - I would expect that you either compiled your BSP without network support or that you did something wrong with your configuration. So I agree with @Someprogrammerdude: A complete example with at least your Init and configuration would be necessary. – Christian Mauderer Jan 04 '18 at 08:50

0 Answers0