Module tcp

Module tcp 

Source
Expand description

This module provides the basic types necessary to be able to handle connections and message transmission in both synchronous and asynchronous contexts.

The types here should simplify implementation of higher level layers and protocols.

Structs§

AsyncMutex
An asynchronous Mutex-like type.
AsyncMutexGuard
A handle to a held Mutex. The guard can be held across any .await point as it is Send.
AsyncRwLock
An asynchronous reader-writer lock.
RUMClient
This structs encapsulates the tokio::net::TcpStream instance that will be our adapter for connecting and sending messages to a peer or server.
RUMClientHandle
Handle struct containing a reference to the global Tokio runtime and an instance of SafeClient. This handle allows sync codebases to interact with the async primitives built on top of Tokio. Specifically, this handle allows wrapping of the async connect, send, and receive methods implemented in RUMClient.
RUMServer
This is the Server primitive that listens for incoming connections and manages “low-level” messages.
RUMServerHandle
Handle struct containing a reference to the global Tokio runtime and an instance of SafeServer. This handle allows sync codebases to interact with the async primitives built on top of Tokio. Specifically, this handle allows wrapping of the async bind, send, receive, and start methods implemented in RUMServer. In addition, this handle allows spinning a server in a fully non-blocking manner. Meaning, you can call start, which will immediately return after queueing the task in the tokio queue. You can then query the server for incoming data or submit your own data while the server is operating in the background. The server can be handling incoming data at the “same” time you are trying to queue your own message.
RwLockReadGuard
RAII structure used to release the shared read access of a lock when dropped.
RwLockWriteGuard
RAII structure used to release the exclusive write access of a lock when dropped.
TcpListener
A TCP socket server, listening for connections.
TcpStream
A TCP stream between a local and a remote socket.

Enums§

SOCKET_READINESS_TYPE
Enum used for selecting which clients to iterate through. Pass SOCKET_READINESS_TYPE::NONE to ignore filtering by readiness type.

Constants§

ANYHOST
Convenience constant for the 0.0.0.0 address. This is to be used in contexts in which you do not have any interface preference.
LOCALHOST
Convenience constant to localhost

Type Aliases§

ClientIDList
List of client IDs that you can interact with.
ClientList
List of clients that you can interact with.
ConnectionInfo
RUMNetMessage
ReceivedRUMNetMessage
SafeClient
SafeListener
SafeServer