|
Boost Users : |
Subject: [Boost-users] basic_endpoint how to assign it
From: Marco Piacentini (marcopiacenta_at_[hidden])
Date: 2011-03-07 09:28:15
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_endpointboost::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_at_[hidden]>
A: boost-users_at_[hidden]
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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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