File I / O with UDP with Boost ASIO

So I'm trying to use boost.log with a syslog shell on my FreeBSD servers that run rsyslogd and listen on the file socket for UDP data. Apparently, this works on FreeBSD ground. Indeed, a file socket is a dgram socket (telnet for a file socket is another thing that works in FreeBSD):

$ telnet /var/run/log Trying /var/run/log... /var/run/log: Protocol wrong type for socket 

In any case, boost.log will not communicate with the file socket with only an IP address. My plan is to provide proxy information between a regular UDP IP server, which my application connects to a file socket. Theoretically, this should work fine.

However, I cannot find a way to get ASIO to communicate via UDP with a file socket, or even with a file socket in general. I understand that there may be ways to work with file I / O using ASIO, but this seems to be a complicated Google search - nothing significant comes up. Only a few things (on this very site) that should deal with Windows I / O and ASIO at best.

Ideally, I would look for something like this (although this does not exist at all):

 socket.send_to(boost::asio::buffer(data, length), boost::asio::ip::udp::endpoint(boost::asio::ip::file_address("/var/run/log"), port); 

But I'll take everything that works.

+4
source share

Source: https://habr.com/ru/post/1440184/


All Articles