Comments (7)
Hello. I'm really appreciated your commit. However, I need to notice one moment, the function 'from_string' can't recognize 'localhost' like an address. I have to use 'resolver' to use 'localhost' like the address instead of only '127.0.0.1' in order to overcove the problem. That is why I didn't use 'from_string' instead of 'resolver'.
Could you propose a solution with a simultaneously equivalent behavior to use 'localhost' and '127.0.0.1' like the address excluding the solution with 'resolver'?
Thank you again.
from redis-cpp.
I had looked at the latest 'boost' (1.73) again and noticed 'resolver.resolve' among the examples (the link below). Why did you decide the 'resolver.resolve' is deprecated?
https://www.boost.org/doc/libs/1_73_0/libs/beast/example/http/client/sync/http_client_sync.cpp
from redis-cpp.
Hello. From your message I noticed you used cygwin thus I decided you used Windows. I don't use Windows more than 10 year, I'm Linux user last 10 years. I can't check particularly your case. Nevertheless, I've tried to fix the problem having seen on your commit. Appealing to that I'd like to propose you trying use it with new macros. If you use header-only version, try to update the library from git and use it with a macros REDISCPP_EASY_ADDRESS_RESOLVE. Please define it before usage the library like below
#define REDISCPP_EASY_ADDRESS_RESOLVE
#include ...
Unfortunatelly, in this case you can't use something like 'localhost', only IP like '127.0.0.1' or others.
Also, report me about results of usage with a new macros, of course, if you would mind :)
Thanks for addressing me about your issue. Hopefully, my commit will fix the problem. I will be waiting for your report about usage of the changes.
from redis-cpp.
Maybe this solution works:
stream(const char* host, int port)
{
boost::asio::ip::tcp::resolver resolver{io_context_};
//resolver.resolve() is deprecated
/*auto endpoints = resolver.resolve(std::move(host), std::move(port));
auto iter = std::begin(endpoints);
if (iter == std::end(endpoints))
throw std::runtime_error{"There is no any endpoint."};*/
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::address::from_string(host), port);
socket_.connect(endpoint);
socket_.set_option(boost::asio::ip::tcp::no_delay{});
stream_ = std::make_unique<stream_type>(socket_);
}
from redis-cpp.
I have added a possible PR for this issue:
#2
from redis-cpp.
@tdv Thanks for your fast answer!
However, I need to notice one moment, the function 'from_string' can't recognize 'localhost' like an address. I have to use 'resolver' to use 'localhost' like the address instead of only '127.0.0.1' in order to overcove the problem. That is why I didn't use 'from_string' instead of 'resolver'.
That's a good point!
I have seen in the documentation, that this function is deprecated:
https://www.boost.org/doc/libs/1_73_0/doc/html/boost_asio/reference/ip__tcp/resolver.html
(**Deprecated**: Use overload with separate host and service parameters.) Perform forward resolution of a query to a list of entries.
—
Perform forward resolution of a query to a list of entries.
—
Perform reverse resolution of an endpoint to a list of entries.
With Boost 1.66.0 it doesn't works for me (Version 1.66.0 is the highest version available for Cygwin - i don't have tested it with the newest version 1.73.0).
Could you propose a solution with a simultaneously equivalent behavior to use 'localhost' and '127.0.0.1' like the address excluding the solution with 'resolver'?
I could try it, but i don't know Boost very good.
from redis-cpp.
Done
from redis-cpp.
Related Issues (20)
- cannot pass object of non-trivial type 'const rediscpp::resp::deserialization::error_message' through variadic function HOT 2
- multiple definition in header-only library HOT 2
- GET without erasing information. HOT 1
- Could NOT find Boost (missing: thread system iostreams) (found suitable version "1.74.0", minimum required is "1.67.0") HOT 1
- Fatal error C1189: #error: "RedisCpp. Requires C++ 17 or higher." HOT 2
- Build errors under Ubuntu 18.04 with GCC 9 HOT 3
- how to get pattern/channel info in pub/sub. HOT 2
- how to execute rpush HOT 3
- make error HOT 1
- More connection parameters HOT 1
- Missing cast to array type HOT 3
- SEG SIGNAL when use reset and AUTH enabled HOT 2
- Alternative Redis client proposed for inclusion in Boost HOT 1
- elif with no expression HOT 1
- CLIENT REPLY HOT 1
- 'Scan' function type response std::bad_cast issue HOT 1
- Avoid installing the library in a hard-coded folder in the root of the cmake project?
- bad cast while execute "hset" HOT 1
- how could cast to array HOT 1
- Read array including empty values fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-cpp.