On Fri, 29 Aug 2008, Vjekoslav Brajkovic wrote:
Hi.
When designing server-client model, one has to use boost::asio::ip::tcp::endpoint and boost::asio::ip::tcp::resolver::query respectively. What I am confused about is that query accepts std::string& service as a parameter whereas endpoint only accepts unsigned short.
When writing code, it is really easy to get confused which constructor takes string and which short. I would appreciate is somebody could tell me if there is a way to create a server side component using integer as a service.
Sorry, not the server, but the client. Also, let extend my question. It seems if one wants to resolve a FQDN, first ip::basic_resolver<T> has to be created. Afterwards, basic_resolver.resolve() function should be called which accepts either endpoint_type or query as a parameter. So what I was wondering is: a) What is the point passing endpoint_type, when we know for sure that endpoint will only accept address which *cannot* be a FQDN. What do we achieve by doing this? b) To be more precise: How come basic_resolver_query does not take unsigned short as a parameter for service/port? I apologize if these are somewhat broad questions, however I really would like to know the rational behind some of the design decisions.