|
Boost Users : |
Subject: Re: [Boost-users] passing socket descriptor to a function
From: pedro chaparro (pdro07_at_[hidden])
Date: 2010-01-28 04:12:28
from the main code i call a function to start a server on a port X, already
this server started , i back to main fucntion, make some calculus and after
that i have to write some data through the socket, so i call a writing
fuction, but to this fuction i have to pass to it the data i want transmit
and something to indicate it what's the socket i'm using. I'm not an expert
in programming so i dont know if this is the best way to do it. I just want
to access to the variable socket from anywhere.
thanks
2010/1/27 Igor R <boost.lists_at_[hidden]>
> > hi for the fast answer, i have other question respect to this, what about
> if
> > i wanna a function return the socket descriptor value? what must be the
> type of value retuned? an int value?
>
> You mean the low-level socket descriptor, which can be used in recv/send
> etc.?
>
> asio::ip::tcp::socket::native_type
> socketDescriptor(asio::ip::tcp::socket &socket)
> {
> return socket.native();
> }
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
-- Ing Pedro Alonso Chaparro Valero Ciudad Politecnica de la Innovación iTEAM - Mobile Communications Group Polytechnic University of Valencia C\ Camino de Vera S/N, Edificio 8G 46022 Valencia, Spain
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