You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal extends ARO-0024 (Socket Communication) with UDP (User Datagram Protocol) support, enabling connectionless, low-latency communication for ARO applications.
Motivation
While TCP (ARO-0024) provides reliable, ordered delivery, many applications benefit from UDP:
Real-time Applications: Gaming, streaming, VoIP where latency matters more than reliability
Broadcasting: One-to-many message distribution
Discovery Protocols: Service discovery, multicast group communication
Start a UDP socket server using the <Start> action with explicit protocol:
(Application-Start: UDP Logger) {
<Log> the <message> for the <console> with "Starting UDP server".
<Start> the <udp-server> on <port> with 9000.
<Keepalive> the <application> for the <events>.
<Return> an <OK: status> for the <startup>.
}
(Handle Datagram Received: UDP Event Handler) {
<Extract> the <data> from the <datagram: buffer>.
<Extract> the <sender> from the <datagram: remoteAddress>.
<Extract> the <port> from the <datagram: remotePort>.
(* Process received data *)
<Transform> the <response> from the <data>.
(* Send response back to sender *)
<Send> the <response> to the <sender> on <port>.
<Return> an <OK: status> for the <datagram>.
}
4. UDP Client
Send datagrams to remote endpoints:
(Send Telemetry: Metrics Reporter) {
<Create> the <metrics> with <cpu-usage> and <memory-usage>.
<Send> the <metrics> via <udp> to <host: "metrics.example.com"> on port 8125.
<Return> an <OK: status> for the <telemetry>.
}
5. Multicast Support
(* Join a multicast group *)
(Application-Start: Discovery Service) {
<Start> the <udp-server> on <port> with 5353.
<Join> the <multicast-group> with "224.0.0.251".
<Keepalive> the <application> for the <events>.
<Return> an <OK: status> for the <startup>.
}
(* Send to multicast group *)
(Announce Service: Discovery) {
<Create> the <announcement> with <service-info>.
<Send> the <announcement> to <multicast: "224.0.0.251"> on port 5353.
<Return> an <OK: status> for the <announcement>.
}
(* UDP Echo Server - Connectionless datagram communication *)
(Application-Start: UDP Echo) {
<Log> the <message> for the <console> with "Starting UDP echo on port 9000".
<Start> the <udp-server> on <port> with 9000.
<Log> the <message> for the <console> with "UDP server listening on port 9000".
<Keepalive> the <application> for the <events>.
<Return> an <OK: status> for the <startup>.
}
(Handle Datagram Received: UDP Event Handler) {
<Extract> the <data> from the <datagram: buffer>.
<Extract> the <sender-address> from the <datagram: remoteAddress>.
<Extract> the <sender-port> from the <datagram: remotePort>.
(* Echo back the received data *)
<Send> the <data> via <udp> to <sender-address> on <sender-port>.
<Log> the <message> for the <console> with "Echoed datagram back to sender".
<Return> an <OK: status> for the <datagram>.
}
TCP vs UDP Comparison
Feature
TCP (ARO-0024)
UDP (ARO-0038)
Connection
Connection-oriented
Connectionless
Reliability
Guaranteed delivery
Best-effort
Ordering
Ordered
No ordering
Events
ClientConnected, DataReceived, ClientDisconnected
DatagramReceived
Use Cases
HTTP, database connections, file transfer
Real-time apps, discovery, metrics
Service Type
<socket-server>
<udp-server>
Implementation Notes
Uses SwiftNIO DatagramBootstrap for non-blocking UDP I/O
No connection state management (connectionless)
Supports IPv4 and IPv6
Multicast group join/leave operations
Maximum datagram size follows OS limits (typically 65,507 bytes for IPv4)
Thread-safe using actor isolation or locks
Use <Keepalive> action to keep the application running for UDP events
Implementation Location (Proposed)
The UDP socket system would be implemented in:
Sources/ARORuntime/Sockets/UDPServer.swift - AROUDPServer class
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
ARO-0038: UDP Socket Communication
Abstract
This proposal extends ARO-0024 (Socket Communication) with UDP (User Datagram Protocol) support, enabling connectionless, low-latency communication for ARO applications.
Motivation
While TCP (ARO-0024) provides reliable, ordered delivery, many applications benefit from UDP:
Proposed Solution
1. UDP Server
Start a UDP socket server using the
<Start>action with explicit protocol:2. Datagram Events
Handle incoming datagrams:
3. Datagram Handlers
4. UDP Client
Send datagrams to remote endpoints:
5. Multicast Support
6. SwiftNIO Implementation
Grammar Extension
Complete Example
TCP vs UDP Comparison
<socket-server><udp-server>Implementation Notes
DatagramBootstrapfor non-blocking UDP I/O<Keepalive>action to keep the application running for UDP eventsImplementation Location (Proposed)
The UDP socket system would be implemented in:
Sources/ARORuntime/Sockets/UDPServer.swift-AROUDPServerclassSources/ARORuntime/Actions/BuiltIn/ServerActions.swift- UDP Start actionSources/ARORuntime/Actions/BuiltIn/ResponseActions.swift- UDP Send actionUDP events would be defined in:
Sources/ARORuntime/Sockets/UDPServer.swift-DatagramReceivedEvent,UDPServerStartedEventSources/ARORuntime/Events/EventTypes.swift- Event type definitionsOpen Questions
<Broadcast>work differently for UDP (actual network broadcast vs. multicast)?Revision History
Beta Was this translation helpful? Give feedback.
All reactions