Hi...actually I have a client and a server and both run on the same machine, but they will be on different machine with different ip address, so I'm trying to set the Server's Ip address to the client, but it can't work:
I've read that the
basic_endpoint(const boost::asio::ip::address & addr,unsigned short port_num);
Construct an endpoint using a port number and an IP addressso I do the following:
int port=60000;
char addr[10]="127.0.0.1"; //or another ip address
tcp::socket socket(io_service);
boost::asio::ip::address a = boost::asio::ip::address::from_string(addr);
now I have an "address", I have a port, so I try to build a basic_endpoint
boost::asio::ip::basic_endpoint<tcp> bend(const boost::asio::ip::address & addr, unsigned short port);
finally I need to make an async:connect to that endpoint
socket. async_connect(bend,boost::bind(connect_handler,boost::asio::placeholders::error,&socket));
but the first parameter of the async_connect is a endpoint and not a basic_endpoint...
How can I say to the client "connect to X.X.X.X Ip address at the port Y"?
thanks...
Da: Igor R <boost.lists@gmail.com>
A: boost-users@lists.boost.org
Inviato: Ven 4 marzo 2011, 10:57:13
Oggetto: Re: [Boost-users] acceptor listen
> I've read all the manual, all the tutorials, all the example and I don't
> want that someone make the job for me.
> I came from java world, where all is documented, all is explained in
> detail...
IMHO, asio is pretty well documented. The problem is that you're
trying to find 1-to-1 relationship between asio model and the native C
sockets. For this you have to explore asio internals, not only the
documentation.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users