DatagramTransport
Defined in: net-transport-node/src/datagram-transport.ts:32
Message-mode Transport over a UDP socket.
Each datagram is delivered as exactly one complete frame: bytes are never
carried across deliveries, so a decoder returning incomplete means the
message was truncated rather than that more is coming. That distinction is
why TransportMode is part of the transport contract — DNS over UDP and
DNS over TCP share a codec but must not share buffering behaviour.
Correlation is the caller’s problem, and cannot be positional: pair this with
a KeyedRegistry over the protocol’s transaction identifier.
Implements
Section titled “Implements”Transport
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DatagramTransport(
socket,options?):DatagramTransport
Defined in: net-transport-node/src/datagram-transport.ts:43
Parameters
Section titled “Parameters”socket
Section titled “socket”Socket
options?
Section titled “options?”Returns
Section titled “Returns”DatagramTransport
Properties
Section titled “Properties”
readonlymode:TransportMode="message"
Defined in: net-transport-node/src/datagram-transport.ts:33
Whether bytes arrive as a stream or as discrete messages.
Implementation of
Section titled “Implementation of”Transport.mode
Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: net-transport-node/src/datagram-transport.ts:140
Tear the transport down immediately, discarding pending I/O.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Transport.destroy
end():
Promise<void>
Defined in: net-transport-node/src/datagram-transport.ts:136
Half-close the outbound direction and resolve once flushed.
Returns
Section titled “Returns”Promise<void>
Resolves when all pending writes have been sent.
Implementation of
Section titled “Implementation of”Transport.end
pause()
Section titled “pause()”pause():
void
Defined in: net-transport-node/src/datagram-transport.ts:123
Stop delivering TransportHandlers[“data”] until resume.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Transport.pause
resume()
Section titled “resume()”resume():
void
Defined in: net-transport-node/src/datagram-transport.ts:127
Resume delivery suspended by pause.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Transport.resume
start()
Section titled “start()”start(
handlers):void
Defined in: net-transport-node/src/datagram-transport.ts:50
Begin delivering data to handlers.
Called once by the FrameLink that owns this transport.
Parameters
Section titled “Parameters”handlers
Section titled “handlers”TransportHandlers
Callbacks to receive data and lifecycle notifications.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Transport.start
stop()
Section titled “stop()”stop():
void
Defined in: net-transport-node/src/datagram-transport.ts:70
Detach the installed handlers without closing the transport.
Used when handing an already-connected transport to another consumer, as in
an HTTP Upgrade. Contrast with destroy, which tears the transport
down.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Transport.stop
write()
Section titled “write()”write(
buffers,signal?):Promise<void>
Defined in: net-transport-node/src/datagram-transport.ts:86
Write buffers as a single logical unit and resolve once accepted.
Fragments are written in order and, where the transport supports it, coalesced into one vectored write. In message mode the buffers form exactly one outbound message.
Parameters
Section titled “Parameters”buffers
Section titled “buffers”readonly Buffer<ArrayBufferLike>[]
Ordered payload fragments.
signal?
Section titled “signal?”AbortSignal
Cancels the wait for capacity. Note that bytes already handed to the transport cannot be unsent; aborting rejects the caller but does not retract the write.
Returns
Section titled “Returns”Promise<void>
Resolves once the transport has accepted the bytes and any backpressure has cleared.
Implementation of
Section titled “Implementation of”Transport.write