Error::BindIPAddress
Hi,
I'm using this awesome library to perform some http requests from my c++ utility application. However, I keep getting Error::BindIPAddress from the library and I cannot find out why.
I'm working on Mac and trying to send http request to an http server running on localhost:8080, the code looks like that:
httplib::Client cli("http://localhost:8080");
cli.Post(...)
Thanks a lot!
@kubistika, thank you for the feedback, but I don't know why either. Could you try cd test; make to see what happens? Also does curl with the same POST request work on your machine? Hope it helps!
BindIPAddress should only be happening in server mode. If it is really happening in client mode, then something strange is going on. Otherwise, it might be that port 8080 is already occupied and the server cannot use it, or that the server process is prohibited from listening on localhost interface for some reason.
BindIPAddress should only be happening in server mode. If it is really happening in client mode, then something strange is going on. Otherwise, it might be that port 8080 is already occupied and the server cannot use it, or that the server process is prohibited from listening on localhost interface for some reason.
Yea, that's why I think something is weird because I'm not even using the http server of this library.
Actually, nevermind. Inspecting the code, BindIPAddress can occur on the client. Wonder what your ifconfig looks like.
Googling, it appears that some other libraries experience this issue if not all the fields of certain socket-related struct have been initialized to 0, and stackoverflow lists that similar issues may occur because certain Mac OS versions lack named aliases for the loopback interface by default. Not sure if any of these are relevant to your issue.