udt4
Version:
A node.js UDT binding for FAST data transfers
62 lines (38 loc) • 1.59 kB
Markdown
is a wrapper around the UDT4 library.
See [http://en.wikipedia.org/wiki/UDP-based_Data_Transfer_Protocol](http://en.wikipedia.org/wiki/UDP-based_Data_Transfer_Protocol)
*This library is intentionally marked as 0.1.0 and should be considered alpha*
```
udt4.createServer(function (data) {
console.log(data);
}).listen(1337);
```
```
var udt4 = require('../udt4');
var clt = udt4.createClient(1337, '127.0.0.1');
clt.write('data\n');
clt.end();
```
Returns a new server object.
The dataListener is a function which is automatically added to the 'data' event.
Begin accepting connections on the specified port. As the hostname is currently omitted, the server will accept connections directed to any IPv4 address (INADDR_ANY).
### server.close()
Stops the server from accepting new connections and keeps existing connections. This function is asynchronous, the server is finally closed when all connections are ended and the server emits a 'close' event.
### udt4.createClient()
Constructs a new UDT4 client. port and host refer to the server to be connected to.
### client.connect(port, [host])
Opens a connection to the server
### client.write(data)
Sends data to the server.
### client.end()
Closes the connection to the server.
## contributors
<table><tbody>
<tr><th align="left">Anton Whalley</th><td><a href="https://gitlab.com/u/no9">GitLab/No9</a></td><td><a href="https://twitter.com/dhigit9">Twitter/@dhigit9</a></td></tr>
</tbody></table>
This