The real socket handle is stored in `socket._handle`, not in `socket`.

пятница, 27 июля 2012 г., 16:04:44 UTC+4 пользователь sgimeno написал:
>
> Hello,
>
> I'm developing a C++ addon and I'm trying to access the object wrap of a 
> unix stream net.Socket. Basically what I'm doing is:
>
> 1) in C++ land
>
> /* The first argument of the function is the socket */
> Local<Object> obj = args[0]->ToObject();
>  if (obj->InternalFieldCount() > 0) {
>         PipeWrap* wrap = 
> static_cast<PipeWrap*>(obj->GetPointerFromInternalField(0));
> }
>
> 2) in JS
>
> var socket = new Socket(fd); // fd is a file descriptor of an already 
> created unix socket
> my_function(socket); // call my_function implemented in the C++ addon
>
> The problem I'm having is that the object internalFieldCount is 0. Any 
> ideas of what I'm doing wrong?
>
> Thanks in advance.
>
> Santi
>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to