package luv
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Binding to libuv: cross-platform asynchronous I/O
Install
dune-project
Dependency
Authors
Maintainers
Sources
luv-0.5.3.tar.gz
sha256=2e15054fe841d9f820ba3e2c9c313a5a5e2150f3b78136ce585a3609dba758bc
md5=352dc50b19479500e3b1ba3b89ae5056
doc/index.html
Luv
Luv is a binding to libuv, the cross-platform C library that does asynchronous I/O in Node.js and runs Node's main loop.
let () =
Luv.DNS.getaddrinfo ~family:`INET ~node:"google.com" ~service:"80" ()
begin fun result ->
let address = (List.hd (Result.get_ok result)).addr in
let socket = Luv.TCP.init () |> Result.get_ok in
Luv.TCP.connect socket address begin fun _ ->
Luv.Stream.write socket [Luv.Buffer.from_string "GET / HTTP/1.1\r\n\r\n"]
(fun _ _ -> Luv.Stream.shutdown socket ignore);
Luv.Stream.read_start socket (function
| Error `EOF -> Luv.Handle.close socket ignore
| Error _ -> exit 2
| Ok response -> print_string (Luv.Buffer.to_string response))
end
end;
ignore (Luv.Loop.run () : bool)This is the auto-generated API reference. For more conceptual information and examples, see:
- Project page
- User guide
- Examples, which are presented in the user guide.
API reference
Basics
Luv.Error— error handlingLuv.Loop— event loopsLuv.Buffer— byte buffersLuv.Handle— persistent objects (sockets, etc.)Luv.Stream— base type for TCP sockets, pipes, TTY handlesLuv.Request— contexts for asynchronous requests
Main interface
Luv.Timer— timersLuv.Signal— signalsLuv.Process— subprocessesLuv.TCP— TCP socketsLuv.UDP— UDP socketsLuv.DNS— DNSLuv.Pipe— pipesLuv.TTY— consolesLuv.File— file operationsLuv.FS_event— filesystem events
System threads
Luv.Thread_pool— libuv thread poolLuv.Thread— general system threadsLuv.TLS— thread-local storageLuv.Once— once-only barriersLuv.Mutex— mutexesLuv.Rwlock— read-write locksLuv.Semaphore— semaphoresLuv.Condition— condition variablesLuv.Barrier— barriers
Miscellaneous
Luv.Env— environment variablesLuv.Time— current timeLuv.Path— relevant directoriesLuv.Random— system entropy sourceLuv.Sockaddr— network addressesLuv.Network— network interfaces and hostnameLuv.FS_poll— filesystem pollingLuv.Poll— file descriptor pollingLuv.Resource— resource usageLuv.System_info— system informationLuv.Pid— process idsLuv.Os_fd— system file descriptor interopLuv.DLL— dynamic linkingLuv.Passwd— current user informationLuv.Async— inter-loop communicationLuv.Prepare— pre-I/O callbacksLuv.Check— post-I/O callbacksLuv.Idle— per-iteration callbacksLuv.Version— libuv version
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page