← All compilation units

Flyology.IO.Sockets

Description

Owns Flyology's portable socket, Internet-address, and endpoint types. Socket calls use one synchronous API in both task lanes: lightweight callers suspend on readiness while native callers block only their thread. The private socket representation is a limited owning handle. Ownership can move between handles, but it cannot be copied by assignment.

Interrupt sets compose independent lifecycle sources such as connection close, server shutdown, and per-operation cancellation. This package never consumes or closes an interrupt source, and every owner must outlive the operation.

Accept_Connection

function Accept_Connection
  (Set     : not null access Flyology.Operations.Completion_Set'Class;
   Server  : not null access Socket_Type;
   Timeout : Duration := Infinite) return Accept_Operation

Start one Internet-stream accept. Server remains borrowed until Finish; the accepted socket and peer endpoint are retained by the operation.

Parameters
Set

Completion set that owns the operation slot

Server

Aliased open Internet-stream listener

Timeout

Relative operation deadline in seconds

Return value

Started limited accept operation

Accept_Connection

function Accept_Connection
  (Set     : not null access Flyology.Operations.Completion_Set'Class;
   Server  : not null access Socket_Type;
   Timeout : Duration := Infinite) return Unix_Accept_Operation

Start one Unix-stream accept. The result type distinguishes this overload from the Internet form with the same familiar parameters.

Parameters
Set

Completion set that owns the operation slot

Server

Aliased open Unix-stream listener

Timeout

Relative operation deadline in seconds

Return value

Started limited Unix accept operation

Accept_Connection

procedure Accept_Connection
  (Server     : Socket_Type;
   Socket     : in out Socket_Type;
   Address    : out Endpoint;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Accept one connection and configure it for Flyology I/O. Transient admission errors are retried and descriptor pressure uses bounded interruptible backoff.

Parameters
Server

Open listener; ownership is retained

Socket

Newly accepted socket owned by the caller

Address

Accepted peer endpoint

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before an accept

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Accept or setup fails

Program_Error

Socket is already open

Accept_Connection

procedure Accept_Connection
  (Server     : Socket_Type;
   Socket     : in out Socket_Type;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Accept one pathname Unix-stream connection and configure it for Flyology I/O. No peer pathname is returned because connected pathname clients commonly have no bound address. Filesystem permissions control connection admission only; peer credentials and application trust must be established separately when required.

Parameters
Server

Open AF_UNIX stream listener; ownership is retained

Socket

Newly accepted socket owned by the caller

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before an accept

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Accept or setup fails

Program_Error

Socket is already open

Accept_Connection

procedure Accept_Connection
  (Server    : not null access Socket_Type;
   Timeout   : Duration := Infinite;
   Operation : in out Accept_Operation)

Start or restart one Internet-stream accept in an established object.

Parameters
Server

Aliased open Internet-stream listener

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed accept operation

Accept_Connection

procedure Accept_Connection
  (Server    : not null access Socket_Type;
   Timeout   : Duration := Infinite;
   Operation : in out Unix_Accept_Operation)

Start or restart one Unix-stream accept in an established object.

Parameters
Server

Aliased open Unix-stream listener

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed Unix accept operation

Accept_Operation

type Accept_Operation is new Socket_Operation with private;

Scoped acceptance of one Internet-stream connection. A successful operation owns the accepted socket until typed Finish transfers it.

Accept_Socket

procedure Accept_Socket
  (Server  : Socket_Type;
   Socket  : in out Socket_Type;
   Address : out Endpoint;
   Timeout : Duration;
   Status  : out Selector_Status)

Accept with a bounded task-aware wait and return rather than raise on timeout.

Parameters
Server

Open listener

Socket

Accepted socket when Status is Completed

Address

Accepted peer endpoint

Timeout

Maximum wait in seconds

Status

Completion status

Raised exceptions
Program_Error

Socket is already open

Address_Family

type Address_Family is
  (IPv4,
   IPv6);

Address family represented by an Internet address or endpoint.

Enumeration literals
IPv4

Internet Protocol version 4

IPv6

Internet Protocol version 6

Adopt

procedure Adopt (Source : in out Descriptor; Target : in out Socket_Type)

Transfer one descriptor into a closed socket handle. Source becomes Invalid_Descriptor. The caller must ensure Source is the sole closing owner represented by that descriptor.

Parameters
Source

Descriptor whose ownership transfers

Target

Closed socket handle that receives ownership

Raised exceptions
Program_Error

Source is invalid or Target is open

Any_IPv4

Any_IPv4      : constant IP_Address (IPv4) := (Family => IPv4, V4 => (others => 0));

IPv4 wildcard address.

Any_IPv6

Any_IPv6      : constant IP_Address (IPv6) := (Family => IPv6, V6 => (others => 0));

IPv6 wildcard address.

Any_Port

Any_Port : constant Port := 0;

Port wildcard used when the operating system should choose a local port.

Bind_Socket

procedure Bind_Socket (Socket : Socket_Type; Address : Endpoint)

Bind Socket to a local endpoint.

Parameters
Socket

Open socket

Address

Local endpoint

Raised exceptions
Socket_Error

bind fails

Bind_Socket

procedure Bind_Socket (Socket : Socket_Type; Address : Unix_Path)

Bind Socket to a pathname Unix address. The operating system creates a filesystem entry, normally governed by the process umask and directory permissions. Flyology never removes or replaces that entry: its owner must unlink stale and final entries, while excluding unsafe namespace replacement. Binding does not authenticate future peers.

Parameters
Socket

Open AF_UNIX stream socket

Address

Validated filesystem pathname

Raised exceptions
Socket_Error

bind fails, including an existing entry or a directory permission failure

Buffer_Receive_Operation

type Buffer_Receive_Operation is new Socket_Operation with private;

Scoped receive into a uniquely owned buffer.

Buffer_Send_All_Operation

type Buffer_Send_All_Operation is new Socket_Operation with private;

Scoped complete send from a uniquely owned buffer.

Buffer_Send_Operation

type Buffer_Send_Operation is new Socket_Operation with private;

Scoped one-step send from a uniquely owned buffer.

Close_Socket

procedure Close_Socket (Socket : in out Socket_Type)

Close Socket. The handle becomes closed even when close reports an error because descriptor state is no longer safely reusable.

Parameters
Socket

Sole closing owner

Raised exceptions
Socket_Error

Close fails

Connect

function Connect
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Server     : Endpoint;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Connect_Operation

Start one Internet-stream connection attempt. Socket remains borrowed until Finish; cancellation does not roll back kernel connection effects.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open unconnected Internet socket

Server

Destination endpoint copied into the operation

Timeout

Relative operation deadline in seconds

Interrupts

Readable lifecycle sources borrowed until completion

Return value

Started limited connect operation

Connect

function Connect
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Server     : Unix_Path;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Connect_Operation

Start one Unix-stream connection attempt.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open unconnected Unix-stream socket

Server

Validated destination pathname copied into the operation

Timeout

Relative operation deadline in seconds

Interrupts

Readable lifecycle sources borrowed until completion

Return value

Started limited connect operation

Connect

procedure Connect
  (Socket     : Socket_Type;
   Server     : Endpoint;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Connect Socket to Server with task-aware readiness and one deadline. An attempt that the kernel is still establishing, including one reported as interrupted by a signal, resolves through the same deadline.

Parameters
Socket

Open unconnected socket; ownership is retained

Server

Destination endpoint

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before connection

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Connect or setup fails

Connect

procedure Connect
  (Socket     : Socket_Type;
   Server     : Unix_Path;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Connect Socket to a pathname Unix-stream server with task-aware readiness and one deadline. The pathname names a filesystem entry, not an authenticated peer; callers remain responsible for peer trust.

Parameters
Socket

Open AF_UNIX stream socket; ownership is retained

Server

Validated destination pathname

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before connection

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Connect or setup fails

Connect

procedure Connect
  (Socket     : not null access Socket_Type;
   Server     : Endpoint;
   Timeout    : Duration := Infinite;
   Operation  : in out Connect_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart one Internet-stream connection attempt in an established operation object.

Parameters
Socket

Aliased open unconnected Internet socket

Server

Destination endpoint copied into the operation

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed connect operation

Interrupts

Readable lifecycle sources borrowed until completion

Connect

procedure Connect
  (Socket     : not null access Socket_Type;
   Server     : Unix_Path;
   Timeout    : Duration := Infinite;
   Operation  : in out Connect_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart one Unix-stream connection attempt.

Parameters
Socket

Aliased open unconnected Unix-stream socket

Server

Validated destination pathname copied into the operation

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed connect operation

Interrupts

Readable lifecycle sources borrowed until completion

Connect_Operation

type Connect_Operation is new Socket_Operation with private;

Scoped Internet-stream connection attempt.

Connect_Socket

procedure Connect_Socket (Socket : Socket_Type; Server : Endpoint)

Connect without readiness orchestration or a deadline. Intended for blocking native setup and datagram peer selection; use Connect for task-aware streams. A signal that interrupts the attempt does not abort it: the kernel keeps establishing the connection, so this call then waits for the socket to resolve and reports the pending socket error. A lightweight caller must first call Prepare or otherwise ensure the descriptor is nonblocking: a blocking connect syscall can occupy its execution group's event-loop pthread. After an interrupted or in-progress nonblocking attempt, the wait blocks a native pthread or suspends only the calling lightweight task until the handshake succeeds or fails.

Parameters
Socket

Open socket

Server

Destination endpoint

Raised exceptions
Socket_Error

connect fails or the connection is refused

Device_Error

Readiness polling fails

Control_Socket

procedure Control_Socket (Socket : Socket_Type; Request : in out Request_Type)

Apply or query a descriptor-control request.

Parameters
Socket

Open socket

Request

Request and returned query value

Raised exceptions
Socket_Error

Configuration or query fails

Create_Socket

procedure Create_Socket
  (Socket : in out Socket_Type; Family : Address_Family := IPv4; Mode : Socket_Mode := Socket_Stream)

Create one blocking socket. Task-aware operations configure it as nonblocking before use; immediate operations do not.

Parameters
Socket

Newly created socket owned by the caller

Family

Internet address family

Mode

Stream or datagram semantics

Raised exceptions
Socket_Error

Creation or descriptor configuration fails

Program_Error

Socket is already open

Create_Socket_Pair

procedure Create_Socket_Pair
  (Left : in out Socket_Type; Right : in out Socket_Type; Mode : Socket_Mode := Socket_Stream)

Create a connected local socket pair for IPC and testing. Both sockets are blocking until Prepare or another descriptor control makes them nonblocking.

Parameters
Left

First socket owned by the caller

Right

Second socket owned by the caller

Mode

Stream or datagram semantics

Raised exceptions
Socket_Error

Creation or descriptor configuration fails

Program_Error

Either target is open or both targets alias

Create_Unix_Stream_Socket

procedure Create_Unix_Stream_Socket (Socket : in out Socket_Type)

Create one blocking AF_UNIX SOCK_STREAM socket. Task-aware operations configure it as nonblocking before use; immediate operations do not. Unix pathname sockets are supported on macOS and Linux; no Windows backend is provided.

Parameters
Socket

Newly created socket owned by the caller

Raised exceptions
Socket_Error

Creation or descriptor configuration fails

Program_Error

Socket is already open

Datagram_Metadata

type Datagram_Metadata is record
   Source          : Endpoint;
   Destination     : Endpoint;
   Original_Length : Natural := 0;
   Truncated       : Boolean := False;
   ECN             : ECN_Codepoint := ECN_Unavailable;
end record;

Addressing and delivery information for one received datagram. Source and Destination retain the peer and the local address selected by the kernel, including the bound local port. Original_Length is the whole datagram length even when only Item'Length bytes were copied.

Record fields
Source

Remote source endpoint

Destination

Local destination endpoint selected by the kernel

Original_Length

Whole datagram length before caller truncation

Truncated

True when Original_Length exceeds the receive buffer

ECN

Received Explicit Congestion Notification value

Datagram_Operation

type Datagram_Operation is abstract new Socket_Operation with private;

Common limited base for scoped datagram operations.

ECN_Codepoint

type ECN_Codepoint is (ECN_Unavailable, Not_ECT, ECT_One, ECT_Zero, Congestion_Experienced);

Explicit Congestion Notification value carried by a received IP datagram. Unavailable is retained as a narrow extension seam for an adopted socket or a future platform backend that cannot expose the IP traffic-class ancillary value.

Enumeration literals
ECN_Unavailable

No traffic-class ancillary value was supplied

Not_ECT

The packet is not ECN-capable

ECT_One

The packet carries the ECT(1) codepoint

ECT_Zero

The packet carries the ECT(0) codepoint

Congestion_Experienced

The packet carries the CE codepoint

Enable_Datagram_Metadata

procedure Enable_Datagram_Metadata (Socket : Socket_Type)

Enable destination-address and ECN ancillary delivery on an Internet datagram socket. Create_Socket does this automatically for Socket_Datagram; this idempotent operation is provided for adopted datagram descriptors.

Parameters
Socket

Open IPv4 or IPv6 datagram socket

Raised exceptions
Socket_Error

Address or traffic-class metadata setup fails

Endpoint

type Endpoint (Family : Address_Family := IPv4) is record
   Address : IP_Address (Family);
   Port    : Flyology.IO.Sockets.Port := Any_Port;
   Scope   : Scope_ID := 0;
end record;

Portable Internet address, port, and optional IPv6 interface scope.

Record fields
Family

Internet protocol version

Address

Internet address in Family

Port

Host-order TCP or UDP port

Scope

IPv6 interface scope, or zero when unspecified

Error_Type

type Error_Type is
  (Success,
   Resource_Temporarily_Unavailable,
   Interrupted_System_Call,
   Operation_Now_In_Progress,
   Operation_Already_In_Progress,
   Transport_Endpoint_Already_Connected,
   No_Buffer_Space_Available,
   Other_Error);

Stable classification of operating-system socket errors.

Enumeration literals
Success

No error

Resource_Temporarily_Unavailable

Operation would block

Interrupted_System_Call

Operation was interrupted by a signal

Operation_Now_In_Progress

Nonblocking connection is in progress

Operation_Already_In_Progress

Connection is already in progress

Transport_Endpoint_Already_Connected

Socket is already connected

No_Buffer_Space_Available

Kernel socket buffers are exhausted

Other_Error

Error has no portable Flyology classification

Finish

procedure Finish (Operation : in out Accept_Operation; Socket : in out Socket_Type; Address : out Endpoint)

Consume one successful Internet-stream accept and transfer ownership. Socket must be closed. Provider failure is retained until this call.

Parameters
Operation

Terminal accept operation

Socket

Closed target that receives the accepted socket

Address

Accepted peer endpoint

Finish

procedure Finish (Operation : in out Buffer_Receive_Operation; Received : out Natural)

Consume one unique-buffer receive and commit its readable length.

Parameters
Operation

Terminal unique-buffer receive operation

Received

Number of received bytes; zero on closure

Finish

procedure Finish (Operation : in out Buffer_Send_All_Operation)

Consume one complete unique-buffer send.

Parameters
Operation

Terminal complete unique-buffer send operation

Finish

procedure Finish (Operation : in out Buffer_Send_Operation; Sent : out Natural)

Consume one partial unique-buffer send.

Parameters
Operation

Terminal unique-buffer send operation

Sent

Number of bytes sent

Finish

procedure Finish (Operation : in out Connect_Operation)

Consume one terminal Internet- or Unix-stream connection attempt.

Parameters
Operation

Terminal connect operation

Raised exceptions
Operation_Interrupted

An interrupt descriptor became ready

Finish

procedure Finish
  (Operation : in out Receive_Datagram_Operation;
   Last      : out Ada.Streams.Stream_Element_Offset;
   Metadata  : out Datagram_Metadata)

Consume a terminal datagram receive and publish its payload bounds and addressing metadata.

Parameters
Operation

Terminal datagram receive operation

Last

Last copied element, or Item'First - 1 when none was copied

Metadata

Peer, local destination, length, truncation, and ECN

Finish

procedure Finish (Operation : in out Receive_Exactly_Operation)

Consume one terminal exact receive.

Parameters
Operation

Terminal exact-receive operation

Finish

procedure Finish (Operation : in out Receive_Operation; Last : out Ada.Streams.Stream_Element_Offset)

Consume one terminal partial receive and publish its Last value.

Parameters
Operation

Terminal receive operation

Last

Last received element, or Item'First - 1 on closure

Finish

procedure Finish (Operation : in out Send_All_Operation)

Consume one terminal complete send.

Parameters
Operation

Terminal complete-send operation

Finish

procedure Finish
  (Operation : in out Send_Datagram_Operation; Last : out Ada.Streams.Stream_Element_Offset)

Consume a terminal datagram send and publish its Last value.

Parameters
Operation

Terminal datagram send operation

Last

Last sent element, or Item'First - 1 for an empty datagram

Finish

procedure Finish (Operation : in out Send_Operation; Last : out Ada.Streams.Stream_Element_Offset)

Consume one terminal partial send and publish its Last value.

Parameters
Operation

Terminal send operation

Last

Last sent element, or Item'First - 1 when none

Finish

procedure Finish (Operation : in out Unix_Accept_Operation; Socket : in out Socket_Type)

Consume one successful Unix-stream accept and transfer ownership.

Parameters
Operation

Terminal Unix accept operation

Socket

Closed target that receives the accepted socket

Get_Peer_Name

function Get_Peer_Name (Socket : Socket_Type) return Endpoint

Return Socket's peer endpoint.

Parameters
Socket

Connected Internet socket

Return value

Peer endpoint

Raised exceptions
Socket_Error

getpeername fails or is not an Internet address

Get_Socket_Name

function Get_Socket_Name (Socket : Socket_Type) return Endpoint

Return Socket's local endpoint.

Parameters
Socket

Open Internet socket

Return value

Local endpoint

Raised exceptions
Socket_Error

getsockname fails or is not an Internet address

Image

function Image (Value : Endpoint) return String

Format an endpoint, enclosing IPv6 addresses in brackets.

Parameters
Value

Endpoint to format

Return value

Numeric address and port

Image

function Image (Value : IP_Address) return String

Format an Internet address without a port.

Parameters
Value

Address to format

Return value

Canonical numeric address text selected by the host

Image

function Image (Value : Unix_Path) return String

Return the pathname bytes supplied to Unix_Pathname.

Parameters
Value

Unix-socket pathname

Return value

Original pathname bytes

IP_Address

type IP_Address (Family : Address_Family := IPv4) is record
   case Family is
      when IPv4 =>
         V4 : IPv4_Octets;
      when IPv6 =>
         V6 : IPv6_Octets;
   end case;
end record;

Portable Internet address value with no dependency on sockaddr layout.

Record fields
Family

Internet protocol version

V4

Network-order IPv4 octets when Family is IPv4

V6

Network-order IPv6 octets when Family is IPv6

IPv4_Octets

type IPv4_Octets is array (Positive range 1 .. 4) of Octet;

Four network-order IPv4 octets.

IPv6_Octets

type IPv6_Octets is array (Positive range 1 .. 16) of Octet;

Sixteen network-order IPv6 octets.

Is_IP_Address

function Is_IP_Address (Text : String; Family : Address_Family) return Boolean

Report whether Text is a numeric address in Family.

Parameters
Text

Candidate numeric address

Family

Required address family

Return value

True when Text parses in Family

Is_Open

function Is_Open (Socket : Socket_Type) return Boolean

Report whether Socket currently owns an operating-system descriptor.

Parameters
Socket

Socket to inspect

Return value

True when Socket owns an open descriptor

Listen_Socket

procedure Listen_Socket (Socket : Socket_Type; Length : Positive := 15)

Mark a stream socket as a listener.

Parameters
Socket

Bound stream socket

Length

Maximum pending connection count

Raised exceptions
Socket_Error

listen fails

Loopback_IPv4

Loopback_IPv4 : constant IP_Address (IPv4) := (Family => IPv4, V4 => (127, 0, 0, 1));

IPv4 loopback address.

Loopback_IPv6

Loopback_IPv6 : constant IP_Address (IPv6) := (Family => IPv6, V6 => (16 => 1, others => 0));

IPv6 loopback address.

Maximum_Unix_Path_Length

function Maximum_Unix_Path_Length return Positive

Return the host pathname capacity of sockaddr_un.sun_path, excluding the terminating NUL.

Return value

Maximum accepted Unix pathname length in bytes

Move

procedure Move (Source : in out Socket_Type; Target : in out Socket_Type)

Transfer ownership from Source to a closed Target. Source is closed on return. Moving a closed Source leaves both handles closed.

Parameters
Source

Handle whose ownership transfers

Target

Closed handle that receives ownership

Raised exceptions
Program_Error

Target is open

Native_Descriptor

function Native_Descriptor (Socket : Socket_Type) return Descriptor

Return Socket's operating-system descriptor without transferring ownership.

Parameters
Socket

Socket to inspect

Return value

Borrowed descriptor; Socket remains its owner

Network_Endpoint

function Network_Endpoint
  (Address : IP_Address; Port : Flyology.IO.Sockets.Port; Scope : Scope_ID := 0) return Endpoint

Construct an endpoint from an address and host-order port.

Parameters
Address

Internet address

Port

Host-order port

Scope

Optional IPv6 interface scope

Return value

Endpoint containing the supplied values

No_Endpoint

No_Endpoint   : constant Endpoint := (Family => IPv4, Address => Any_IPv4, Port => Any_Port, Scope => 0);

Sentinel endpoint used when no Internet endpoint is available.

Octet

subtype Octet is Ada.Streams.Stream_Element;

One address octet.

Operation_Interrupted

Operation_Interrupted : exception;

Raised when a member of an operation's interrupt set becomes readable.

Option_Level

type Option_Level is (Socket_Level);

Protocol layer for supported socket options. Only SOL_SOCKET is exposed.

Enumeration literals
Socket_Level

Operating-system socket option level

Option_Name

type Option_Name is (Reuse_Address, Reuse_Port, Receive_Timeout);

Supported socket option names.

Enumeration literals
Reuse_Address

Permit local address reuse

Reuse_Port

Permit multiple opted-in sockets to bind one endpoint

Receive_Timeout

Bound blocking receives in native setup code

Option_Type

type Option_Type (Name : Option_Name := Reuse_Address) is record
   case Name is
      when Reuse_Address | Reuse_Port =>
         Enabled : Boolean := False;
      when Receive_Timeout =>
         Timeout : Duration := 0.0;
   end case;
end record;

Socket options supported by Flyology's portable layer.

Record fields
Name

Selected option

Enabled

Reuse_Address or Reuse_Port setting

Timeout

Receive_Timeout interval in seconds

Parse_IP_Address

function Parse_IP_Address (Text : String) return IP_Address

Parse a numeric IPv4 or IPv6 address. Name resolution is deliberately outside this operation.

Parameters
Text

Numeric address text

Return value

Parsed Internet address

Raised exceptions
Constraint_Error

Text is not a numeric Internet address

Port

type Port is range 0 .. 65_535;

Host-order TCP or UDP port.

Prepare

procedure Prepare (Socket : Socket_Type)

Enable nonblocking and close-on-exec modes. Configuration is retained by the owning handle and repeated calls for the same descriptor generation do not repeat operating-system setup.

Parameters
Socket

Open socket to configure

Raised exceptions
Socket_Error

Descriptor configuration fails

Receive

function Receive
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Receive_Operation

Start one nonblocking receive operation. Socket and Item must outlive the returned operation. Item is exclusively borrowed until Finish.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased destination buffer

Timeout

Relative operation deadline in seconds

Interrupts

Readable lifecycle sources borrowed through completion

Return value

Started limited receive operation

Receive

function Receive
  (Set     : not null access Flyology.Operations.Completion_Set'Class;
   Socket  : not null access Socket_Type;
   Item    : not null access Flyology.Buffers.Unique_Buffer;
   Timeout : Duration := Infinite) return Buffer_Receive_Operation

Start one receive into an acquired unique buffer. The driver enters the buffer's writable callback only for each immediate socket step and does not retain the callback view. Finish commits the new readable length.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased acquired destination buffer

Timeout

Relative operation deadline in seconds

Return value

Started limited unique-buffer receive operation

Receive

procedure Receive
  (Socket     : Socket_Type;
   Item       : out Ada.Streams.Stream_Element_Array;
   Last       : out Ada.Streams.Stream_Element_Offset;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Receive one available chunk with task-aware readiness and one deadline.

Parameters
Socket

Open connected socket

Item

Destination buffer

Last

Last element received, or Item'First - 1 on orderly closure

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before readiness

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Socket receive or setup fails

Receive

procedure Receive
  (Socket     : Socket_Type;
   Item       : in out Flyology.Buffers.Unique_Buffer;
   Received   : out Natural;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Receive directly into an acquired unique buffer and replace its readable length. The buffer remains solely owned by the caller while the kernel borrows its storage.

Parameters
Socket

Open connected socket

Item

Acquired destination buffer

Received

Number of bytes received; zero on orderly closure

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before readiness

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Socket receive or setup fails

Receive

procedure Receive
  (Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Operation  : in out Receive_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart a receive in an established operation object. This form lets a higher-level provider retain the child as a record component and compose it with Operations.Continue_After.

Parameters
Socket

Aliased open connected socket

Item

Aliased destination buffer

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed receive operation

Interrupts

Readable lifecycle sources borrowed through completion

Receive

procedure Receive
  (Socket    : not null access Socket_Type;
   Item      : not null access Flyology.Buffers.Unique_Buffer;
   Timeout   : Duration := Infinite;
   Operation : in out Buffer_Receive_Operation)

Start or restart a unique-buffer receive in an established operation.

Parameters
Socket

Aliased open connected socket

Item

Aliased acquired destination buffer

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed buffer-receive operation

Receive_Datagram

function Receive_Datagram
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Receive_Datagram_Operation

Start one datagram receive. A zero-length Item still consumes one zero-length datagram. Socket and Item remain borrowed until Finish.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open datagram socket

Item

Aliased destination buffer

Timeout

Relative operation deadline in seconds

Interrupts

Readable lifecycle sources borrowed through completion

Return value

Started limited datagram receive operation

Receive_Datagram

function Receive_Datagram
  (Set                  : not null access Flyology.Operations.Completion_Set'Class;
   Socket               : not null access Socket_Type;
   Item                 : not null access Ada.Streams.Stream_Element_Array;
   Timeout              : Duration;
   Interrupts           : Interrupt_Set;
   Additional           : Flyology.IO.Descriptor;
   Additional_For_Write : Boolean) return Receive_Datagram_Operation

Start one datagram receive while also observing one caller-borrowed latched descriptor in its requested direction. This additive overload keeps the readable Interrupt_Set unchanged and never consumes or closes Additional. The caller must disarm its source borrow after wakeup before querying or releasing that source again.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open datagram socket

Item

Aliased destination buffer

Timeout

Relative operation deadline in seconds

Interrupts

Readable lifecycle sources borrowed through completion

Additional

Valid caller-borrowed latched descriptor

Additional_For_Write

True to observe Additional write readiness

Return value

Started limited datagram receive operation

Raised exceptions
Program_Error

Additional is invalid

Receive_Datagram

procedure Receive_Datagram
  (Socket     : Socket_Type;
   Item       : out Ada.Streams.Stream_Element_Array;
   Last       : out Ada.Streams.Stream_Element_Offset;
   Metadata   : out Datagram_Metadata;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Receive one UDP datagram with task-aware readiness and one deadline. Source and local destination endpoints are returned atomically with the payload. Last denotes bytes copied into Item; Metadata retains the whole datagram length and states whether the payload was truncated. A zero-length datagram is consumed and returns Last = Item'First - 1. Lightweight callers suspend only their task; native callers may block only their pthread. Created datagram sockets already have the required ancillary options; call Enable_Datagram_Metadata after Adopt.

Parameters
Socket

Open IPv4 or IPv6 datagram socket

Item

Destination buffer, which may be empty

Last

Last copied element, or Item'First - 1 when none was copied

Metadata

Peer, local destination, length, truncation, and ECN

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before a datagram arrives

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Metadata setup or recvmsg fails

Receive_Datagram

procedure Receive_Datagram
  (Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Operation  : in out Receive_Datagram_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart one datagram receive in an established operation.

Parameters
Socket

Aliased open datagram socket

Item

Aliased destination buffer

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed receive operation

Interrupts

Readable lifecycle sources borrowed through completion

Receive_Datagram

procedure Receive_Datagram
  (Socket               : not null access Socket_Type;
   Item                 : not null access Ada.Streams.Stream_Element_Array;
   Timeout              : Duration;
   Operation            : in out Receive_Datagram_Operation;
   Interrupts           : Interrupt_Set;
   Additional           : Flyology.IO.Descriptor;
   Additional_For_Write : Boolean)

Start or restart one datagram receive with a direction-sensitive caller-borrowed latched descriptor in an established operation.

Parameters
Socket

Aliased open datagram socket

Item

Aliased destination buffer

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed receive operation

Interrupts

Readable lifecycle sources borrowed through completion

Additional

Valid caller-borrowed latched descriptor

Additional_For_Write

True to observe Additional write readiness

Raised exceptions
Program_Error

Additional is invalid

Receive_Datagram_Operation

type Receive_Datagram_Operation is new Datagram_Operation with private;

Scoped receive of one complete datagram and its metadata.

Receive_Exactly

function Receive_Exactly
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Receive_Exactly_Operation

Start a nonblocking operation that fills Item. The operation rearms read readiness after partial progress.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased destination buffer to fill

Timeout

Shared relative deadline in seconds

Interrupts

Readable lifecycle sources borrowed through completion

Return value

Started limited exact-receive operation

Receive_Exactly

procedure Receive_Exactly
  (Socket     : Socket_Type;
   Item       : out Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Fill Item or raise. One Timeout deadline spans every partial receive.

Parameters
Socket

Open connected socket

Item

Destination buffer to fill

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The shared deadline expires

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Polling fails or peer closes before completion

Socket_Error

Socket receive or setup fails

Receive_Exactly

procedure Receive_Exactly
  (Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Operation  : in out Receive_Exactly_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart an exact receive in an established operation object.

Parameters
Socket

Aliased open connected socket

Item

Aliased destination buffer to fill

Timeout

Shared relative deadline in seconds

Operation

Fresh, released, or consumed exact-receive operation

Interrupts

Readable lifecycle sources borrowed through completion

Receive_Exactly_Operation

type Receive_Exactly_Operation is new Socket_Operation with private;

Scoped stream receive that fills its array.

Receive_Operation

type Receive_Operation is new Socket_Operation with private;

Scoped one-step stream receive.

Receive_Socket

procedure Receive_Socket
  (Socket : Socket_Type;
   Item   : out Ada.Streams.Stream_Element_Array;
   Last   : out Ada.Streams.Stream_Element_Offset)

Receive one immediate chunk without readiness orchestration. A lightweight caller must first call Prepare or otherwise ensure the descriptor is nonblocking; a blocking receive can occupy its execution group's event-loop pthread.

Parameters
Socket

Open socket

Item

Destination buffer

Last

Last element received, or Item'First - 1 on closure

Raised exceptions
Socket_Error

recv fails

Receive_Socket

procedure Receive_Socket
  (Socket : Socket_Type;
   Item   : out Ada.Streams.Stream_Element_Array;
   Last   : out Ada.Streams.Stream_Element_Offset;
   From   : out Endpoint)

Receive one datagram and its source endpoint without readiness orchestration. A lightweight caller must first call Prepare or otherwise ensure the descriptor is nonblocking; a blocking receive can occupy its execution group's event-loop pthread. From is No_Endpoint when the socket source has no Internet endpoint, including an AF_UNIX socket pair.

Parameters
Socket

Open datagram socket

Item

Destination buffer

Last

Last element received

From

Source endpoint

Raised exceptions
Socket_Error

recvfrom fails

Release

procedure Release (Source : in out Socket_Type; Target : out Descriptor)

Transfer Socket's descriptor without closing it. Source is closed on return; Target is Invalid_Descriptor when Source was already closed.

Parameters
Source

Socket whose ownership transfers

Target

Descriptor that receives ownership

Request_Name

type Request_Name is (Non_Blocking_IO, N_Bytes_To_Read);

Portable descriptor-control request names.

Enumeration literals
Non_Blocking_IO

Enable or disable nonblocking mode

N_Bytes_To_Read

Query the immediately readable byte count

Request_Type

type Request_Type (Name : Request_Name) is record
   case Name is
      when Non_Blocking_IO =>
         Enabled : Boolean := False;
      when N_Bytes_To_Read =>
         Size : Natural := 0;
   end case;
end record;

Portable descriptor-control requests.

Record fields
Name

Selected request

Enabled

Non_Blocking_IO setting

Size

N_Bytes_To_Read query result

Resolve_Exception

function Resolve_Exception (Occurrence : Ada.Exceptions.Exception_Occurrence) return Error_Type

Recover the stable error category embedded in Socket_Error.

Parameters
Occurrence

Socket_Error occurrence raised by this package

Return value

Portable error category

Scope_ID

type Scope_ID is mod 2**32;

Host interface scope for an IPv6 endpoint; zero means unspecified.

Selector_Status

type Selector_Status is (Completed, Expired);

Compatibility status for bounded native accepts.

Enumeration literals
Completed

A connection was accepted

Expired

The accept deadline expired

Send

function Send
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Send_Operation

Start one nonblocking partial send operation. Item is read-only while borrowed even though its access value designates a variable array.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased source buffer

Timeout

Relative operation deadline in seconds

Interrupts

Readable lifecycle sources borrowed through completion

Return value

Started limited send operation

Send

function Send
  (Set     : not null access Flyology.Operations.Completion_Set'Class;
   Socket  : not null access Socket_Type;
   Item    : not null access Flyology.Buffers.Unique_Buffer;
   Timeout : Duration := Infinite) return Buffer_Send_Operation

Start one partial send from an acquired unique buffer.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased acquired source buffer

Timeout

Relative operation deadline in seconds

Return value

Started limited unique-buffer send operation

Send

procedure Send
  (Socket     : Socket_Type;
   Item       : Ada.Streams.Stream_Element_Array;
   Last       : out Ada.Streams.Stream_Element_Offset;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Send one available chunk with task-aware readiness and one deadline.

Parameters
Socket

Open connected socket

Item

Source buffer

Last

Last element sent, or Item'First - 1 if none

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before readiness

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Socket send or setup fails

Send

procedure Send
  (Socket     : Socket_Type;
   Item       : Flyology.Buffers.Unique_Buffer;
   Sent       : out Natural;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Send one available chunk directly from a unique buffer. No Flyology payload copy is made and Item remains owned by the caller.

Parameters
Socket

Open connected socket

Item

Acquired source buffer

Sent

Number of bytes sent

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before readiness

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails

Socket_Error

Socket send or setup fails

Send

procedure Send
  (Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Operation  : in out Send_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart a partial send in an established operation object.

Parameters
Socket

Aliased open connected socket

Item

Aliased source buffer

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed send operation

Interrupts

Readable lifecycle sources borrowed through completion

Send

procedure Send
  (Socket    : not null access Socket_Type;
   Item      : not null access Flyology.Buffers.Unique_Buffer;
   Timeout   : Duration := Infinite;
   Operation : in out Buffer_Send_Operation)

Start or restart a unique-buffer send in an established operation.

Parameters
Socket

Aliased open connected socket

Item

Aliased acquired source buffer

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed buffer-send operation

Send_All

function Send_All
  (Set        : not null access Flyology.Operations.Completion_Set'Class;
   Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts) return Send_All_Operation

Start a nonblocking operation that sends all of Item.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased source buffer

Timeout

Shared relative deadline in seconds

Interrupts

Readable lifecycle sources borrowed through completion

Return value

Started limited complete-send operation

Send_All

function Send_All
  (Set     : not null access Flyology.Operations.Completion_Set'Class;
   Socket  : not null access Socket_Type;
   Item    : not null access Flyology.Buffers.Unique_Buffer;
   Timeout : Duration := Infinite) return Buffer_Send_All_Operation

Start a complete send from an acquired unique buffer.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open connected socket

Item

Aliased acquired source buffer

Timeout

Shared relative deadline in seconds

Return value

Started limited complete unique-buffer send operation

Send_All

procedure Send_All
  (Socket     : Socket_Type;
   Item       : Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Send all of Item or raise. One Timeout deadline spans every partial send.

Parameters
Socket

Open connected socket

Item

Source buffer to send completely

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The shared deadline expires

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Polling fails or no forward progress is made

Socket_Error

Socket send or setup fails

Send_All

procedure Send_All
  (Socket     : Socket_Type;
   Item       : Flyology.Buffers.Unique_Buffer;
   Timeout    : Duration := Infinite;
   Interrupts : Interrupt_Set := No_Interrupts)

Send a unique buffer's complete readable payload without a Flyology payload copy. Item remains owned until the synchronous call returns.

Parameters
Socket

Open connected socket

Item

Acquired source buffer

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The shared deadline expires

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Polling fails or no forward progress is made

Socket_Error

Socket send or setup fails

Send_All

procedure Send_All
  (Socket     : not null access Socket_Type;
   Item       : not null access Ada.Streams.Stream_Element_Array;
   Timeout    : Duration := Infinite;
   Operation  : in out Send_All_Operation;
   Interrupts : Interrupt_Set := No_Interrupts)

Start or restart a complete send in an established operation object.

Parameters
Socket

Aliased open connected socket

Item

Aliased source buffer

Timeout

Shared relative deadline in seconds

Operation

Fresh, released, or consumed complete-send operation

Interrupts

Readable lifecycle sources borrowed through completion

Send_All

procedure Send_All
  (Socket    : not null access Socket_Type;
   Item      : not null access Flyology.Buffers.Unique_Buffer;
   Timeout   : Duration := Infinite;
   Operation : in out Buffer_Send_All_Operation)

Start or restart a complete unique-buffer send in an established operation object.

Parameters
Socket

Aliased open connected socket

Item

Aliased acquired source buffer

Timeout

Shared relative deadline in seconds

Operation

Fresh, released, or consumed buffer-send operation

Send_All_Operation

type Send_All_Operation is new Socket_Operation with private;

Scoped stream send that transfers its complete array.

Send_Datagram

function Send_Datagram
  (Set         : not null access Flyology.Operations.Completion_Set'Class;
   Socket      : not null access Socket_Type;
   Item        : not null access constant Ada.Streams.Stream_Element_Array;
   Destination : Endpoint;
   Source      : Endpoint;
   Timeout     : Duration := Infinite) return Send_Datagram_Operation

Start one datagram send with an explicit local source selection.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open datagram socket

Item

Aliased source buffer

Destination

Remote destination endpoint

Source

Local source endpoint and interface selection

Timeout

Relative operation deadline in seconds

Return value

Started limited datagram send operation

Send_Datagram

function Send_Datagram
  (Set         : not null access Flyology.Operations.Completion_Set'Class;
   Socket      : not null access Socket_Type;
   Item        : not null access constant Ada.Streams.Stream_Element_Array;
   Destination : Endpoint;
   Timeout     : Duration := Infinite) return Send_Datagram_Operation

Start one datagram send using the kernel-selected local source. Socket and Item remain borrowed until Finish.

Parameters
Set

Completion set that owns the operation slot

Socket

Aliased open datagram socket

Item

Aliased source buffer

Destination

Remote destination endpoint

Timeout

Relative operation deadline in seconds

Return value

Started limited datagram send operation

Send_Datagram

procedure Send_Datagram
  (Socket      : Socket_Type;
   Item        : Ada.Streams.Stream_Element_Array;
   Last        : out Ada.Streams.Stream_Element_Offset;
   Destination : Endpoint;
   Source      : Endpoint;
   Timeout     : Duration := Infinite;
   Interrupts  : Interrupt_Set := No_Interrupts)

Send one UDP datagram while selecting its local source endpoint. Source normally comes from received Metadata.Destination. Its address and IPv6 scope select sendmsg packet information; its port must equal Socket's bound local port because a per-datagram port cannot be selected. Empty Item sends a zero-length datagram. A successful call sends the complete datagram.

Parameters
Socket

Open IPv4 or IPv6 datagram socket

Item

Datagram payload, which may be empty

Last

Last element sent, or Item'First - 1 for an empty datagram

Destination

Remote destination endpoint

Source

Local source endpoint and interface selection

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before readiness

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails or a partial send occurs

Socket_Error

Source validation, setup, or sendmsg fails

Send_Datagram

procedure Send_Datagram
  (Socket      : Socket_Type;
   Item        : Ada.Streams.Stream_Element_Array;
   Last        : out Ada.Streams.Stream_Element_Offset;
   Destination : Endpoint;
   Timeout     : Duration := Infinite;
   Interrupts  : Interrupt_Set := No_Interrupts)

Send one UDP datagram to Destination with task-aware readiness and one deadline. The kernel selects the local source address. Empty Item sends a zero-length datagram. A successful call sends the complete datagram.

Parameters
Socket

Open IPv4 or IPv6 datagram socket

Item

Datagram payload, which may be empty

Last

Last element sent, or Item'First - 1 for an empty datagram

Destination

Remote destination endpoint

Timeout

Deadline interval in seconds

Interrupts

Independent readable lifecycle wake descriptors

Raised exceptions
Timeout_Error

The deadline expires before readiness

Operation_Interrupted

An interrupt descriptor is readable

Device_Error

Readiness polling fails or a partial send occurs

Socket_Error

Socket setup or sendmsg fails

Send_Datagram

procedure Send_Datagram
  (Socket      : not null access Socket_Type;
   Item        : not null access constant Ada.Streams.Stream_Element_Array;
   Destination : Endpoint;
   Source      : Endpoint;
   Timeout     : Duration := Infinite;
   Operation   : in out Send_Datagram_Operation)

Start or restart one source-selected datagram send.

Parameters
Socket

Aliased open datagram socket

Item

Aliased source buffer

Destination

Remote destination endpoint

Source

Local source endpoint and interface selection

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed send operation

Send_Datagram

procedure Send_Datagram
  (Socket      : not null access Socket_Type;
   Item        : not null access constant Ada.Streams.Stream_Element_Array;
   Destination : Endpoint;
   Timeout     : Duration := Infinite;
   Operation   : in out Send_Datagram_Operation)

Start or restart one destination-only datagram send.

Parameters
Socket

Aliased open datagram socket

Item

Aliased source buffer

Destination

Remote destination endpoint

Timeout

Relative operation deadline in seconds

Operation

Fresh, released, or consumed send operation

Send_Datagram_Operation

type Send_Datagram_Operation is new Datagram_Operation with private;

Scoped send of one complete datagram.

Send_Operation

type Send_Operation is new Socket_Operation with private;

Scoped one-step stream send.

Send_Socket

procedure Send_Socket
  (Socket : Socket_Type;
   Item   : Ada.Streams.Stream_Element_Array;
   Last   : out Ada.Streams.Stream_Element_Offset)

Send one immediate chunk without readiness orchestration. A lightweight caller must first call Prepare or otherwise ensure the descriptor is nonblocking; a blocking send can occupy its execution group's event-loop pthread.

Parameters
Socket

Open connected socket

Item

Source buffer

Last

Last element sent

Raised exceptions
Socket_Error

send fails

Send_Socket

procedure Send_Socket
  (Socket : Socket_Type;
   Item   : Ada.Streams.Stream_Element_Array;
   Last   : out Ada.Streams.Stream_Element_Offset;
   To     : Endpoint)

Send one datagram to a destination endpoint without readiness orchestration. A lightweight caller must first call Prepare or otherwise ensure the descriptor is nonblocking; a blocking send can occupy its execution group's event-loop pthread.

Parameters
Socket

Open datagram socket

Item

Source buffer

Last

Last element sent

To

Destination endpoint

Raised exceptions
Socket_Error

sendto fails

Set_Socket_Option

procedure Set_Socket_Option (Socket : Socket_Type; Level : Option_Level; Option : Option_Type)

Apply one supported option at its explicit protocol level.

Parameters
Socket

Open socket

Level

Socket option level

Option

Option value

Raised exceptions
Socket_Error

setsockopt fails

Set_Socket_Option

procedure Set_Socket_Option (Socket : Socket_Type; Option : Option_Type)

Apply one supported socket option.

Parameters
Socket

Open socket

Option

Option value

Raised exceptions
Socket_Error

setsockopt fails

Socket_Error

Socket_Error          : exception;

Raised when an operating-system socket operation fails.

Socket_Mode

type Socket_Mode is (Socket_Stream, Socket_Datagram);

Transport semantics requested when a socket is created.

Enumeration literals
Socket_Stream

Reliable byte stream

Socket_Datagram

Message-preserving datagram transport

Socket_Operation

type Socket_Operation is abstract new Flyology.Operations.Operation with private;

Common limited base for scoped stream operations. Concrete operations borrow an aliased socket and buffer until Finish consumes their result.

Socket_Type

type Socket_Type is limited private;

Limited owning operating-system socket handle. A default-initialized handle is closed. Use Move, Adopt, or Release for explicit ownership transfer; ordinary assignment is intentionally unavailable.

Unix_Accept_Operation

type Unix_Accept_Operation is new Socket_Operation with private;

Scoped acceptance of one Unix-stream connection.

Unix_Path

type Unix_Path is private;

Opaque pathname for an AF_UNIX stream socket. Unix_Pathname validates the pathname against the host sockaddr_un.sun_path capacity. Bytes are passed to the operating system unchanged: Flyology performs no character encoding conversion. Abstract Linux namespace addresses are not represented.

Unix_Pathname

function Unix_Pathname (Path : String) return Unix_Path

Construct a pathname Unix-socket address. Path must be nonempty, contain no NUL byte, and be no longer than Maximum_Unix_Path_Length. The limit is host-dependent and excludes the terminating NUL.

Parameters
Path

Filesystem pathname bytes

Return value

Validated Unix-socket pathname

Raised exceptions
Constraint_Error

Path is empty, contains NUL, or is too long