The raw-socket module does something like this: https://npmjs.org/package/raw-socket
It sub-classes from EventEmitter and emits events such as "close" and "error" from the c++ code, e.g. the close event: https://bitbucket.org/stephenwvickers/node-raw-socket/src/7f31f7272827b7580baf989803b9662bb5de43ba/src/raw.cc?at=default#cl-421 The c++ module itself needs to inherit from EventEmitter, I found this easiest to do from within JavaScript: https://bitbucket.org/stephenwvickers/node-raw-socket/src/7f31f7272827b7580baf989803b9662bb5de43ba/index.js?at=default#cl-62 But to make it work fully you need to do this (at least I had to do this at the time): https://bitbucket.org/stephenwvickers/node-raw-socket/src/7f31f7272827b7580baf989803b9662bb5de43ba/index.js?at=default#cl-31 Good luck! Steve -- -- 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 --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
