On 02/08/16 04:33, Ryan Johnston wrote:
Hi,
I have two C++ objects that both inherit from a base class that
initialises uv_tcp_t and common methods (accept/read/write etc).
Object a) calls uv_accept, and reads.
Object b) is then created by Object a) based on what is read/logic.
At this point I would like to clean up Object a) and give control of the
socket to Object b) so it can call read/write etc.
Is there any possible way to move/copy an initialised uv_tcp_t handle to
another while destroying the previously initialised uv_tcp_t handle?
Hi Ryan,
I *think* it can be done, but not without a bit of fiddling:
- first, you need to duplicate the underlying handle / fd
- then use uv_tcp_open in handle b
- on Windows, there is a flag that needs to be set in order to fool
libuv into thinking the handle is connected:
https://github.com/libuv/libuv/issues/397
Then it should work :-)
PS: This is in no way kosher, the libuv police may have some questions
if they find out!
--
Saúl Ibarra Corretgé
http://bettercallsaghul.com
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.