/netlinkwrapper

A node-gyp netLink wrapper

Primary LanguageC++GNU General Public License v2.0GPL-2.0

netlinkwrapper

This is a simple node-gyp module wrapper for the C++ library netLink v1.0.0_pre6. Meaning this is a very simple wrapper for a very simple TCP library. Also, and perhaps most importantly, this is a TCP implementation that only works synchronously, as opposed to Node's asynchronous paradigm.

Purpose

Obviously node's net module is far more suited for TCP communications that this module. However, the net module can only work asynchronously, as is node's design. However if you are in the very rare situation where you need synchronous reading of sockets across platforms then this may suit you.

How to use

As with most node modules, use npm to install it for you.

npm install

Note: node-gyp is a dependency.

Requirements

As mentioned above, have node-gyp installed.

On Windows make sure you have the WIndows Build Tools installed (for ws2_32.lib). The most common way to attain these build tools is to just install Visual Studio 2013.

Example

var netlinkwrapper = require("netlinkwrapper");

var netlink = new netlinkwrapper();

netlink.connect(3000, "localhost");
netlink.blocking(false);

netlink.write("Are we human, or are we dancer?");

while(true) {
    var str = netlink.read(1024);
    console.log("read: " + str);
}

Docs

Docs can be found online at GitHub.

Alternatives

If you are looking for similar functionality, but without the node-gyp dependency I have made a similar (but much slower) module, SyncSocket.

Why the old version, and why that library?

Because it was the easiest for me to get working and met my needs.