I am using the latest version of promotion and promotion.
I have this class:
IPvarson {IPv4, IPv6}; Template & lt; IPVersion version = IPv4> Class Connection {Private: Promotion :: ASIO :: io_service io_service; Boost :: asio :: ip :: tcp :: relay resolver; Boost :: asio :: ip :: tcp :: Resolver :: query query; Boost :: asio :: ip :: tcp :: Resolter :: Itater Iterator; Public: Connection (std :: string host, std :: string port); Virtual Zero Connect () {iterator = resolver.resolve (query); } // Is this the moment where the client actually joins? Virtual Zero Disconnect () {/ * What goes here? *}}; Should I call before solving the query Generally, once you call In your code given above, Asio Tutorial is a good example of this. First synchronous TCP day time server example here:. Note that the code runs first: To convert a query object to a TCP endpoint, and then: To connect the socket object to that end point. What should be done in your io_service :: stop () and then my connection :: connect () call Io_service should call:: Reset () io_service :: run , often call io_service :: stop or io_service :: reset There are some reasons for this. connect method not is actively establishing a connection - tcp :: resolver: : Resolve changes only a query in a TCP endpoint (such as hostname, or an IP address etc.) that can be used to connect to the socket. You usually need an identifier returned by resolver :: resolution and it's a boost :: asio :: ip :: tcp :: socket Connect to the method (or one of the asynchronous varieties) to connect a finishing point.
tcp :: resolver :: iterator endpoint_iterator = resolver.resolve (query);
socket.connect (* endpoint_iterator ++, error); disconnected method, it is entirely up to the application. But usually you will need to keep track of an active connection by encoding a socket object, which you can turn off when calling at disconnect . For an example of this, look for the tutorial titled "Dietite 3 - A Asynchronous TCP Daytime Server" at:
Comments
Post a Comment