Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:24:50+00:00 2026-06-01T09:24:50+00:00

I want to create a native (c++) module for node.js which is able to

  • 0

I want to create a native (c++) module for node.js which is able to send sockets to another node process, which is completely unrelated to the current process. To do so, I tought of using the ancillary library, which has a really, really easy API for this. The problem I have to solve now is how I can get the fd or the handle of a socket object of node.js.

There’s a TCPWrap class in tcp_wrap.cc & tcp_wrap.h, which has a property called handle_, which holds a uv_tcp_t object from libuv, but that property is private. Also I can’t #include because it’s just a module of node.js an not directly in node.js itself. I don’t know if it’s a good idea to copy the source files to my module just to get the that class…

Have you any ides how I could do it?

I doesn’t have to run on winows, tough.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:24:51+00:00Added an answer on June 1, 2026 at 9:24 am

    I finally found a way to do it. You can find the node module here:
    https://github.com/VanCoding/node-ancillary

    I’ve just taken the headers “tcp_wrap.h”,”stream_wrap.h” and “handle_wrap.h” and then included “tcp_wrap.h”.

    I could then get the object the following way:

    TCPWrap* wrap = static_cast<TCPWrap*>(args[0]->ToObject()->GetPointerFromInternalField(0));
    StreamWrap* s = (StreamWrap*)wrap;
    

    The following code then gives access to the file descriptor

    s->GetStream()->fd
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create module which update list of usb devices automatically (not only mass
I want to create server which is able to be connected with multiple clients.
I want to create a native app/web app which works on iPhone, iPad. I
I want to create a textbox which text binds an integer (e.g 123456789), but
I am using the rather excellent IIS7 Rewrite module (V2), and want to create
I want to create native Mac OS X application using Cocoa + Objective C
I want to create a native array and access it managed code. I don't
My company bosses want to create a native version of a currently web-based app
I want to create a dialog with a pointer which points to where the
I'm searching for an easy to handle python native module to create python object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.