influxdb-cxx icon indicating copy to clipboard operation
influxdb-cxx copied to clipboard

UDS (Unix Socket Domain) issue

Open santharamselva opened this issue 5 years ago • 3 comments

Hi,

I am new to C++. I have tried this API. It works good and code is maintained very well. I have tried both HTTP and UDP, it works fine. But I am getting error with UDS. I am not sure, can you please help me to understand and how to fix?

My URL is std::string url = "unix:///tmp/influxdb.sock";

And the error is

terminate called after throwing an instance of boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> > what(): send_to: Protocol wrong type for socket

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Thanks in advance.

santharamselva avatar Sep 03 '19 10:09 santharamselva

Hi, There are 2 types of Unix sockets: stream (as TCP) and datagram (as UDP). As written in the README I'm using Unix datagram socket you are probably trying to connect to stream socket.

awegrzyn avatar Sep 03 '19 14:09 awegrzyn

Hi, I am trying run the beachmark test file. But I am not getting succeed with Unix socket. Could you please share me the sample code to write data via UDS? I couldn't find one.

Thanks

santharamselva avatar Sep 03 '19 14:09 santharamselva

Hi,

I have tried with CURL like curl -XPOST --unix-socket /tmp/influxdb.sock http:/localhost/write?db=test instead of boost.

Is it good practice?

santharamselva avatar Sep 10 '19 08:09 santharamselva