package eio
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0c33742074562631677886f4fe4a02f9672cec94297ff85c2ed854db5baa71aa
sha512=590843cb5fb3906fd5ab9911d29206172d164a53c48e635871a23c95d4cdce8ae0999480471187fdddee8c9c523148911ca140feabde6a826c317671a3b33090
doc/eio.unix/Eio_unix/Net/index.html
Module Eio_unix.NetSource
Extended network API with support for file descriptors.
Types
These extend the types in Eio.Net with support for file descriptors.
Unix address conversions
Note: OCaml's Unix.sockaddr type considers e.g. TCP port 80 and UDP port 80 to be the same thing, whereas Eio regards them as separate addresses that just happen to have the same representation (a host address and a port number), so we have separate "of_unix" functions for each.
val sockaddr_to_unix :
[< Eio.Net.Sockaddr.stream | Eio.Net.Sockaddr.datagram ] ->
Unix.sockaddrCreating or importing sockets
val import_socket_stream :
sw:Eio.Std.Switch.t ->
close_unix:bool ->
Unix.file_descr ->
stream_socketimport_socket_stream ~sw ~close_unix:true fd is an Eio flow that uses fd.
It can be cast to e.g. source for a one-way flow. The socket object will be closed when sw finishes.
The close_unix and sw arguments are passed to Fd.of_unix.
val import_socket_datagram :
sw:Eio.Std.Switch.t ->
close_unix:bool ->
Unix.file_descr ->
datagram_socketimport_socket_datagram ~sw ~close_unix:true fd is an Eio datagram socket that uses fd.
The socket object will be closed when sw finishes.
The close_unix and sw arguments are passed to Fd.of_unix.
val socketpair_stream :
sw:Eio.Std.Switch.t ->
?domain:Unix.socket_domain ->
?protocol:int ->
unit ->
stream_socket * stream_socketsocketpair_stream ~sw () returns a connected pair of flows, such that writes to one can be read by the other.
This creates OS-level resources using socketpair(2). Note that, like all FDs created by Eio, they are both marked as close-on-exec by default.
val socketpair_datagram :
sw:Eio.Std.Switch.t ->
?domain:Unix.socket_domain ->
?protocol:int ->
unit ->
datagram_socket * datagram_socketsocketpair_datagram ~sw () returns a connected pair of flows, such that writes to one can be read by the other.
This creates OS-level resources using socketpair(2). Note that, like all FDs created by Eio, they are both marked as close-on-exec by default.
Private API for backends
getnameinfo sockaddr returns domain name and service for sockaddr.
type Effect.t += | Import_socket_stream : Eio.Std.Switch.t * bool * Unix.file_descr -> stream_socket Effect.t| Import_socket_datagram : Eio.Std.Switch.t * bool * Unix.file_descr -> datagram_socket Effect.t| Socketpair_stream : Eio.Switch.t * Unix.socket_domain * int -> (stream_socket * stream_socket) Effect.t| Socketpair_datagram : Eio.Switch.t * Unix.socket_domain * int -> (datagram_socket * datagram_socket) Effect.t