Git Product home page Git Product logo

hxuv's Introduction

hxuv Build Status

libuv bindings for Haxe

Philosophy

This library targets to express unopinionatedly the libuv api in a Haxe fashion (e.g. managed memory allocation, GC-friendly, allow closures, etc). So there should be 1-to-1 mapping for each API.

Documentation

The original libuv documentation should generally apply. However, function signatures might be slightly different from the original in order to fit the Haxe language.

Supported targets

  • C++, requires the linc_uv library

(possible to support other targets in the future)

Example

// create a echo tcp server
var server = Tcp.alloc();
server.bind('0.0.0.0', 7000, 0);
server.listen(128, function(_) {
	var client = Tcp.alloc();
	server.accept(client);
	client.readStart(function(status, bytes) {
		if(bytes != null) client.write(bytes, function(_) trace('echoed')); // echo
		else client.close(function() trace('closed')); // client ended
	});
});

// connect to the server, send a string and print the echo from server
var tcp = Tcp.alloc();
tcp.connect('127.0.0.1', 7000, function(status) {
	tcp.write(Bytes.ofString('Hello World!'), function(_) trace('written')); // write to server
	tcp.shutdown(function(status) trace('shutdown')); // close the outgoing stream
	tcp.readStart(function(status, bytes) {
		if(bytes != null) trace(bytes.toString());
		else tcp.close(function() trace('closed')); // close the tcp socket
	});
});

Contributions Welcome

  • Complete the API
  • Support other targets

hxuv's People

Contributors

kevinresol avatar

Watchers

paling avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.