Skip to content

本页为英文技术参考;字段、编号与支持状态直接来自同一契约源。中文学习路线见 开发文档。

Network ​

Perform authorized network operations with explicit request/connection identities, bounded payloads and cancellation. This capability is not unrestricted socket access.

Contract: nexa.network/100. API index.

Typical sequence ​

Use the Host’s approved request or connection route, read bounded responses, and close owned connections when finished. Receiving consumes external state and is restricted to Active.

Behavior and limits ​

Timeout can leave an external mutation outcome unknown. A redirect or resolved address remains subject to Host policy; do not retry through another transport to bypass a denied destination.

The recorded Host maps 8 of 8 operations in this group. A mapping is subject to permission, phase, scope, platform and business preconditions. Host snapshot identifies the source revision; negotiate against the actual installed Host.

Operations ​

Request · OpenResponseStream · Cancel · OpenConnection · Listen · Send · Receive · Close

Request ​

NetworkRequest → NetworkResponse

PropertyContract
Local SDK method ID1
KindOperation
Permissionnexa.network.write
Legal phasesActive
IdempotencyOutcomeMayBeUnknown
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
UriUriRefDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
MethodstringDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
HeadersNamedValue[]Structured NamedValue value; follow its linked field contract. A bounded collection; do not assume an unbounded result or unspecified ordering.
BodyBlobRef?Structured BlobRef value; follow its linked field contract. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
CredentialCredentialRef?Structured CredentialRef value; follow its linked field contract. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. An interrupted external effect can have an unknown outcome; reconcile before issuing another effect. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_Request(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_Request_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

OpenResponseStream ​

EntityRequest → BlobRef

PropertyContract
Local SDK method ID2
KindOperation
Permissionnexa.network.write
Legal phasesActive
IdempotencyOutcomeMayBeUnknown
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
IdEntityIdIdentity in this model’s domain. Use the identity issued or declared for this object, not a display name or filesystem path.

Successful result

The Host retains bytes under an opaque, owned blob handle. It is not the bytes themselves and is not portable across loads.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. An interrupted external effect can have an unknown outcome; reconcile before issuing another effect. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_OpenResponseStream(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_OpenResponseStream_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Cancel ​

OperationRequest → Empty

PropertyContract
Local SDK method ID3
KindMutation
Permissionnexa.network.write
Legal phasesActive
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
OperationEntityIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_Cancel(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_Cancel_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

OpenConnection ​

NetworkConnectionRequest → NetworkConnection

PropertyContract
Local SDK method ID4
KindOperation
Permissionnexa.network.write
Legal phasesActive
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
ProtocolQualifiedIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.
AddressstringDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
PortlongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
ScopestringExplicit target scope. The Host checks that the caller is authorized for it.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_OpenConnection(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_OpenConnection_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Listen ​

NetworkConnectionRequest → NetworkConnection

PropertyContract
Local SDK method ID5
KindOperation
Permissionnexa.network.write
Legal phasesActive
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
ProtocolQualifiedIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.
AddressstringDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
PortlongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
ScopestringExplicit target scope. The Host checks that the caller is authorized for it.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_Listen(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_Listen_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Send ​

NetworkSend → Empty

PropertyContract
Local SDK method ID6
KindMutation
Permissionnexa.network.write
Legal phasesActive
IdempotencyOutcomeMayBeUnknown
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
ConnectionNetworkConnectionStructured NetworkConnection value; follow its linked field contract.
DataBlobRefStructured BlobRef value; follow its linked field contract.
Destinationstring?Domain value named by this field; additional accepted values and bounds are determined by the operation and Host policy. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. An interrupted external effect can have an unknown outcome; reconcile before issuing another effect. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_Send(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_Send_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Receive ​

NetworkReceive → NetworkPacket

PropertyContract
Local SDK method ID7
KindOperation
Permissionnexa.network.write
Legal phasesActive
IdempotencyOutcomeMayBeUnknown
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
ConnectionNetworkConnectionStructured NetworkConnection value; follow its linked field contract.
MaximumByteslongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. An interrupted external effect can have an unknown outcome; reconcile before issuing another effect. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_Receive(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_Receive_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Close ​

NetworkConnection → Empty

PropertyContract
Local SDK method ID8
KindMutation
Permissionnexa.network.write
Legal phasesActive
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
IdEntityIdIdentity in this model’s domain. Use the identity issued or declared for this object, not a display name or filesystem path.
ProtocolQualifiedIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.
ScopestringExplicit target scope. The Host checks that the caller is authorized for it.
LoadInstanceIdGuidIdentity of the admitted load that owns this handle; it is not portable to a replacement load.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Network_Close(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Network_Close_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.


来源: NexaCL-Plugin-SDK · Apache-2.0.

Site documentation: CC BY-SA 4.0. Imported SDK documents: Apache-2.0 as marked.