Hello All :
I need to implement an inter-process communication using a socket in order to make this code very portable into other systems.
I do not care what IP address I would use, and honestly I would prefer some RAW socket without IP and a port number if I could.
My options are
use the loopback address (which I have on the system):
int sd = socket( AF_INET, SOCK_DGRAM, 0 );
uart_addr.sin_family = AF_INET;
uart_addr.sin_addr = inet_addr(“127.0.0.1”); (inet_addr is defined in include/arpa/inet.h , and I do not know how to bring in this header file, as I am compiling in samples/net/sockets/can)
uart_addr.sin_port = htons( 9090 );Use the PF_LOCAL (but I can not find a good example on this except https://www.gnu.org/software/libc/manual/html_node/Local-Socket-Example.html,
but what is the ‘filename’ in this case? This example seems to come from the Sun/Oracle project (which is fine, but I do not see the main() here).
PF_LOCAL is defined in the Zephyr docs: https://docs.zephyrproject.org/latest/connectivity/networking/api/ip_4_6.htmlAnother thing I tried
net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)), as in subsys/net/ip/route.c and tests/net/tcp/src/main.c
(not sure if this is portable, but I can get away with this if I can get DUMMY defined in my project)
Any option would work for me, but I guess I am not understanding on how to get one of them to work. May be there are other options out there that I did not see.
To me, what I am trying to do seems simple, but I am not able to get over the hump. Any ideas are appreciated! Thank you and Happy Easter.