Boost logo

Boost Users :

Subject: [Boost-users] info about connect method of boost::asio::ip::tcp::iostream
From: Conoscenza Silente (abruzzoforteegentile_at_[hidden])
Date: 2010-02-17 05:48:06


Hi All
Right now I started using boost::asio::ip::tcp::iostream class.
If I use the constructor of this class with 2 strings stating IP and PORT
everything is fine
and I can connect to my server.

boost::asio::ip::tcp::iostream sockStream("1.2.3.4","5000");

Instead if I use the connect method using the port as int, connection
doesn't happen.

boost::asio::ip::tcp::iostream sockStream;
sockStream.connect ("1.2.3.4", 5000 );
if( sockStream.fail() ){
        std::cout << "I am not connected" << std::endl;
}

What am I doing wrong?
It is something allowed to do or should I use other classes like
resolver::query + resolver::iterator?
Thanks
CS



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net