awegrzyn / influxdb-cxx

C++ client library for InfluxDB 1.x/2.x
MIT License
78 stars 54 forks source link

UDS (Unix Socket Domain) issue #32

Open santharamselva opened 5 years ago

santharamselva commented 5 years ago

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.

awegrzyn commented 5 years ago

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.

santharamselva commented 5 years ago

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 commented 5 years ago

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?