Socket
Provides a rich set of methods and properties for network communications, implementing non-blocking optimistic syscalls with thread pool event multiplexing and zero GC overhead.
Optimistic Syscall-First Architecture with Deterministic Buffer Reuse
High-Performance Networking
Every SystemH socket is set non-blocking from construction. Send() and Receive() immediately attempt raw syscalls without epoll registration overhead. Fallback to epoll/poll occurs only when EWOULDBLOCK is returned, yielding sustained 4,341 MB/s TCP async throughput (1.59x faster than .NET 10) and 4,092 MB/s TCP sync throughput (1.24x faster than raw POSIX). Async completion events reuse fixed-size pre-allocated nodes from System::Threading::ThreadPool, completely eliminating garbage collection jitter and CLR safepoint freezes.
Constructors
Initializes a new instance of the Socket class for the specified address family, socket type, and protocol. Configures the socket for non-blocking optimistic I/O automatically.
Properties
Gets the amount of data that has been received from the network and is available to be read without blocking.
Gets a value that indicates whether a Socket is connected to a remote host as of the last operation.
Gets or sets a value that indicates whether the Socket is in blocking mode.
Gets the address family of the Socket (e.g. InterNetwork, InterNetworkV6).
Gets the type of the Socket (Stream, Dgram, Raw).
Gets the protocol type of the Socket (Tcp, Udp).
Gets the native operating system file descriptor or socket handle.
Methods
Establishes a connection to a remote host specified by an EndPoint.
Associates a Socket with a local network address and port number.
Places a Socket in a listening state for incoming connection attempts.
Creates a new Socket for a newly created incoming connection.
Sends data to a connected Socket using optimistic syscall execution without kernel polling overhead on hot paths.
Receives data from a connected Socket into a receive buffer.
Sends a datagram to the specified remote endpoint (UDP).
Receives a datagram into the data buffer and stores the endpoint of the sender.
Begins an asynchronous request for a remote host connection.
Ends a pending asynchronous connection request.
Sends data asynchronously to a connected Socket using pre-allocated ThreadPool completion nodes.
Ends a pending asynchronous send and returns the number of bytes sent.
Begins to asynchronously receive data from a connected Socket.
Ends a pending asynchronous read and returns the number of bytes received.
Determines the status of the Socket using kernel polling with microsecond precision.
Disables sends and receives on a Socket.
Closes the Socket connection and releases all associated native OS resources.
Sets the specified Socket option to the specified integer value (e.g. TCP_NODELAY, SO_REUSEADDR, SO_RCVBUF).