Re: [asio-users] Hello, from CrazyJim
Brought to you by:
chris_kohlhoff
From: Jim S. <jam...@ya...> - 2007-05-25 17:13:14
|
Thank you. I'm finally understanding the basics of this library. Christopher Kohlhoff <ch...@ko...> wrote: On Thu, 24 May 2007 17:11:21 -0700 (PDT), "Jim Sager" said: > My question is: > What if you had a string and wanted to set the iter to the string. > IE Pseudocode > iter->endpoint().setaddress()="127.0.0.1" If you just want to convert a string into an address, use ip::address::from_string(): ip::address addr = ip::address::from_string("1.2.3.4"); If what you actually wanted was the "well-known" loopback address, it is better to use: ip::address addr = ip::address_v4::loopback(); You can also pass an IP address string to the resolver. I.e. ip::tcp::resolver::query q("1.2.3.4", "http"); works as well as: ip::tcp::resolver::query q("foobar.com", "http"); so that you can write your code so that it doesn't care whether it is given a hostname or an IP address string. Cheers, Chris ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ asio-users mailing list asi...@li... https://lists.sourceforge.net/lists/listinfo/asio-users --------------------------------- Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. |