
Hi Cory, Cory Nelson <phrosty@gmail.com> wrote:
I'd still love to see a utility function connect_host which resolves creates a socket and connects. considering nearly every app will end up rewriting the wheel so to speek with that.
Yes, I've often thought about adding something like this. The biggest issue that has stopped me from doing it yet is the question of how to implement cancellation of an asynchronous version. I.e. during host/service resolution it would require cancellation of the resolver, but cancelling the connect needs the socket to be closed. Another thing that has kept me from doing it is the thought that perhaps most non-trivial apps wouldn't use it anyway. For example, when I run 'telnet localhost' on my system, I get: Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host I would suspect it is a reasonably common requirement that an application display the addresses that it is trying as it tries them, if not to the user at least to an event log. The bottom line is that I'd be very happy to include such a function in asio, but unless we can come up with an elegant interface for it asap, I'm probably not going to be able to include it in a TR2 proposal. Cheers, Chris