Class
Socket
class Socket
Module: System.Networking.Sockets
Assembly: System.Networking.dll
Source file: Socket.rvn
An invocation-owned, nonblocking IPv4 TCP connection or listener.
Remarks
Development after Preview 9. Create a connection with Connect or a listener with Listen, and close promptly. Native handles cannot be constructed or transferred between invocations. Invocation teardown releases remaining connections. IPv6 and stream adapters are not implemented yet. Development overloads accept CancellationToken for individual operations. See the on-site socket guide for ownership and scheduling limits.
Methods
19 items
Accept(cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
Close() -> ()
Closes the connection or listener and settles its uncommitted transfers or accept as Closed.
Static member:
Connect(address: IPAddress, port: int, cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Connects to an address value. IPv6 transport is not supported yet. Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
Static member:
Connect(address: string, port: int, cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
Static member:
Connect(addresses: Sequence<IPAddress>, port: int, cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Tries address values within the existing bounded connection policy. Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
Static member:
Connect(addresses: Sequence<string>, port: int, cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
Static member:
ConnectUntil(addresses: Sequence<IPAddress>, port: int, deadline: NetworkDeadline, cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Performs the operation within a shared deadline without renewing its budget.
Static member:
ConnectUntil(addresses: Sequence<string>, port: int, deadline: NetworkDeadline, cancellationToken?: CancellationToken) -> Task<Result<Socket, SocketError>>
Performs the operation within a shared deadline without renewing its budget.
Equals(other: object?) -> bool
Tests reference identity by default; an ordinary class may override equality.
Inherited from Object.Equals
GetHashCode() -> int
Returns a stable identity hash by default; an ordinary class may override it consistently with equality.
Inherited from Object.GetHashCode
GetLocalPort() -> Result<int, SocketError>
Gets the OS-selected local port of a live listener or connected socket.
GetType() -> TypeInfo
Returns metadata for the concrete runtime type of this instance.
Inherited from Object.GetType
Static member:
Listen(address: IPAddress, port: int, backlog: int) -> Result<Socket, SocketError>
Listens on an address value. IPv6 transport is not supported yet.
Static member:
Listen(address: string, port: int, backlog: int) -> Result<Socket, SocketError>
Binds an IPv4 TCP listener and starts listening.
Receive(buffer: Memory<byte>, cancellationToken?: CancellationToken) -> Task<Result<int, SocketError>>
Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
ReceiveUntil(buffer: Memory<byte>, deadline: NetworkDeadline, cancellationToken?: CancellationToken) -> Task<Result<int, SocketError>>
Performs the operation within a shared deadline without renewing its budget.
Send(buffer: ReadOnlyMemory<byte>, cancellationToken?: CancellationToken) -> Task<Result<int, SocketError>>
Requests cancellation cooperatively; the task is cancelled after provider acknowledgement.
SendUntil(buffer: ReadOnlyMemory<byte>, deadline: NetworkDeadline, cancellationToken?: CancellationToken) -> Task<Result<int, SocketError>>
Performs the operation within a shared deadline without renewing its budget.
ToString() -> string
Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override.
Inherited from Object.ToString