⌂ Modules nupp nupp.io nupp.io.net nupp.io.net.spi nupp.io.net.spi
Implementation interface for network transports.
Importing this declaration opens no sockets. The facade retains the provider table and supplies it as the explicit receiver for every operation. Provider handles are opaque; shared Address values come from nupp.io.net.types.
Listener acceptance, connection completion, and stream I/O are readiness probes. They must not run a private blocking loop. run(timeoutMs) pumps the provider's reactor, and the public facade exposes pumping as nupp.io.net.pump. Keep handle ownership separate for listeners, connect requests, streams, and datagrams.
Pending and EOF conventions differ by operation and are documented below. Report failures through the declared error result rather than disguising them as pending work. A TLS provider wrapping these streams must understand their handle representation; selection cannot make unrelated transport handles interoperable.
Types
Providerinterface
Members Name Kind Description priorityfield listenmethod Creates a TCP listener; returns its handle or nil and an error. listenPathmethod Creates a local-path listener with the requested backlog. listenerPortmethod Returns the bound port, or -1 when no IP port is available. acceptmethod Returns an accepted stream, nil while pending, or nil and an error. closeListenermethod Releases a listener and its pending accept resources. connectmethod Starts a TCP connection request with a millisecond timeout. connectPathmethod Starts a local-path connection request with a millisecond timeout. connectPollmethod Returns the completed stream, nil while pending, or nil and an error. closeConnectmethod Releases the connection request, independently of any resulting stream. readmethod Returns up to wanted bytes; an empty string means no bytes are ready. endedmethod Reports that no further read bytes will arrive. writemethod Returns the accepted byte count, or nil and an error. pendingmethod Returns bytes accepted for writing that have not yet drained. writeFailedmethod Reports a terminal write failure, including one after enqueueing. shuttingDownmethod Reports that the sending half is shutting down. shutdownWritemethod Ends the sending half after queued writes; reports success or an error. addressmethod Returns the canonical peer or local Address, or nil when unavailable. noDelaymethod Sets TCP no-delay behavior on a stream. keepAlivemethod Configures TCP keepalive and its idle delay in milliseconds. broadcastmethod Enables or disables sending broadcast datagrams. multicastTtlmethod Sets the datagram multicast hop limit. multicastLoopmethod Enables or disables local multicast loopback. membershipmethod Joins or leaves a multicast group on the named interface. closeStreammethod Releases a stream and its queued native resources. bindDatagrammethod Creates a bound datagram socket or returns nil and an error. datagramPortmethod Returns the bound datagram port, or -1 when unavailable. receivemethod Returns bytes, source host, source port, truncation flag, and optional error. sendTomethod Sends one datagram to the destination or reports an error. closeDatagrammethod Releases a datagram socket. runmethod Pumps shared reactor readiness for at most timeoutMs milliseconds.
listenmethod
listen : function ( self : Provider , host : string , port : integer , backlog : integer , reusePort : boolean ) : ( any ? , string ? )
@readonly
Creates a TCP listener; returns its handle or nil and an error.
Arguments Name Type Description selfProvider hoststring portinteger backloginteger reusePortboolean
Returns Type Description any ? string ?
listenPathmethod
listenPath : function ( self : Provider , path : string , backlog : integer ) : ( any ? , string ? )
@readonly
Creates a local-path listener with the requested backlog.
Arguments Name Type Description selfProvider pathstring backloginteger
Returns Type Description any ? string ?
listenerPortmethod
listenerPort : function ( self : Provider , listener : any ) : integer
@readonly
Returns the bound port, or -1 when no IP port is available.
Arguments Name Type Description selfProvider listenerany
Returns
acceptmethod
accept : function ( self : Provider , listener : any ) : ( any ? , string ? )
@readonly
Returns an accepted stream, nil while pending, or nil and an error.
Arguments Name Type Description selfProvider listenerany
Returns Type Description any ? string ?
closeListenermethod
closeListener : function ( self : Provider , listener : any ) : nil
@readonly
Releases a listener and its pending accept resources.
Arguments Name Type Description selfProvider listenerany
Returns
connectmethod
connect : function ( self : Provider , host : string , port : integer , timeoutMs : integer ) : ( any ? , string ? )
@readonly
Starts a TCP connection request with a millisecond timeout.
Arguments Name Type Description selfProvider hoststring portinteger timeoutMsinteger
Returns Type Description any ? string ?
connectPathmethod
connectPath : function ( self : Provider , path : string , timeoutMs : integer ) : ( any ? , string ? )
@readonly
Starts a local-path connection request with a millisecond timeout.
Arguments Name Type Description selfProvider pathstring timeoutMsinteger
Returns Type Description any ? string ?
connectPollmethod
connectPoll : function ( self : Provider , request : any ) : ( any ? , string ? )
@readonly
Returns the completed stream, nil while pending, or nil and an error.
Arguments Name Type Description selfProvider requestany
Returns Type Description any ? string ?
closeConnectmethod
closeConnect : function ( self : Provider , request : any ) : nil
@readonly
Releases the connection request, independently of any resulting stream.
Arguments Name Type Description selfProvider requestany
Returns
readmethod
read : function ( self : Provider , stream : any , wanted : integer ) : ( string ? , string ? )
@readonly
Returns up to wanted bytes; an empty string means no bytes are ready. Use ended to distinguish EOF. nil with an error reports a failed read.
Arguments Name Type Description selfProvider streamany wantedinteger
Returns Type Description string ? string ?
endedmethod
ended : function ( self : Provider , stream : any ) : boolean
@readonly
Reports that no further read bytes will arrive.
Arguments Name Type Description selfProvider streamany
Returns
writemethod
write : function ( self : Provider , stream : any , bytes : string ) : ( integer ? , string ? )
@readonly
Returns the accepted byte count, or nil and an error. Accepted bytes may remain queued; pending reports their outstanding count.
Arguments Name Type Description selfProvider streamany bytesstring
Returns Type Description integer ? string ?
pendingmethod
pending : function ( self : Provider , stream : any ) : integer
@readonly
Returns bytes accepted for writing that have not yet drained.
Arguments Name Type Description selfProvider streamany
Returns
writeFailedmethod
writeFailed : function ( self : Provider , stream : any ) : boolean
@readonly
Reports a terminal write failure, including one after enqueueing.
Arguments Name Type Description selfProvider streamany
Returns
shuttingDownmethod
shuttingDown : function ( self : Provider , stream : any ) : boolean
@readonly
Reports that the sending half is shutting down.
Arguments Name Type Description selfProvider streamany
Returns
shutdownWritemethod
shutdownWrite : function ( self : Provider , stream : any ) : ( boolean , string ? )
@readonly
Ends the sending half after queued writes; reports success or an error.
Arguments Name Type Description selfProvider streamany
Returns Type Description boolean string ?
addressmethod
@readonly
Returns the canonical peer or local Address, or nil when unavailable.
Arguments Name Type Description selfProvider streamany peerboolean
Returns
noDelaymethod
noDelay : function ( self : Provider , stream : any , enable : boolean ) : ( boolean , string ? )
@readonly
Sets TCP no-delay behavior on a stream.
Arguments Name Type Description selfProvider streamany enableboolean
Returns Type Description boolean string ?
keepAlivemethod
keepAlive : function ( self : Provider , stream : any , enable : boolean , delayMs : integer ) : ( boolean , string ? )
@readonly
Configures TCP keepalive and its idle delay in milliseconds.
Arguments Name Type Description selfProvider streamany enableboolean delayMsinteger
Returns Type Description boolean string ?
broadcastmethod
broadcast : function ( self : Provider , socket : any , enable : boolean ) : ( boolean , string ? )
@readonly
Enables or disables sending broadcast datagrams.
Arguments Name Type Description selfProvider socketany enableboolean
Returns Type Description boolean string ?
multicastTtlmethod
multicastTtl : function ( self : Provider , socket : any , ttl : integer ) : ( boolean , string ? )
@readonly
Sets the datagram multicast hop limit.
Arguments Name Type Description selfProvider socketany ttlinteger
Returns Type Description boolean string ?
multicastLoopmethod
multicastLoop : function ( self : Provider , socket : any , enable : boolean ) : ( boolean , string ? )
@readonly
Enables or disables local multicast loopback.
Arguments Name Type Description selfProvider socketany enableboolean
Returns Type Description boolean string ?
membershipmethod
membership : function (
self : Provider ,
socket : any ,
group : string ,
interfaceAddress : string ,
join : boolean
) : ( boolean , string ? )
@readonly
Joins or leaves a multicast group on the named interface. An empty interface address selects the host default.
Arguments Name Type Description selfProvider socketany groupstring interfaceAddressstring joinboolean
Returns Type Description boolean string ?
closeStreammethod
closeStream : function ( self : Provider , stream : any ) : nil
@readonly
Releases a stream and its queued native resources.
Arguments Name Type Description selfProvider streamany
Returns
bindDatagrammethod
bindDatagram : function ( self : Provider , host : string , port : integer , reusePort : boolean ) : ( any ? , string ? )
@readonly
Creates a bound datagram socket or returns nil and an error.
Arguments Name Type Description selfProvider hoststring portinteger reusePortboolean
Returns Type Description any ? string ?
datagramPortmethod
datagramPort : function ( self : Provider , socket : any ) : integer
@readonly
Returns the bound datagram port, or -1 when unavailable.
Arguments Name Type Description selfProvider socketany
Returns
receivemethod
receive : function ( self : Provider , socket : any , maximum : integer ) : ( string ? , string ? , integer ? , boolean ? , string ? )
@readonly
Returns bytes, source host, source port, truncation flag, and optional error. A nil first result without an error means no datagram is ready.
Arguments Name Type Description selfProvider socketany maximuminteger
Returns Type Description string ? string ? integer ? boolean ? string ?
sendTomethod
sendTo : function ( self : Provider , socket : any , host : string , port : integer , bytes : string ) : ( boolean , string ? )
@readonly
Sends one datagram to the destination or reports an error.
Arguments Name Type Description selfProvider socketany hoststring portinteger bytesstring
Returns Type Description boolean string ?
closeDatagrammethod
closeDatagram : function ( self : Provider , socket : any ) : nil
@readonly
Releases a datagram socket.
Arguments Name Type Description selfProvider socketany
Returns
runmethod
run : function ( self : Provider , timeoutMs : integer ) : nil
@readonly
Pumps shared reactor readiness for at most timeoutMs milliseconds. A zero timeout performs a nonblocking pass.
Arguments Name Type Description selfProvider timeoutMsinteger
Returns
← Previous nupp.io.net Next → nupp.io.path