Skip to main content
The Socket provides network connectivity for Tashi Vertex, allowing the consensus engine to communicate with peers in the network.

Methods

bind

Binds a Tashi Vertex socket to the specified address.
pub fn bind(context: &Context, address: &str) -> impl Future<Output = crate::Result<Self>>

Parameters

context
&Context
required
Reference to a Tashi Vertex context
address
&str
required
The address to bind to. Must be a valid IPv4 or IPv6 address including the port number (e.g., “0.0.0.0:8080” or ”[::]:8080”).

Returns

return
Future<Output = Result<Socket>>
Returns a Future that resolves to a Socket on success, or an Error::SocketBind if the bind operation fails.
The address must be a valid IPv4 or IPv6 address, including the port number. DNS lookup is not performed.

Example

use tashi_vertex::{Context, Socket};

let context = Context::new()?;
let socket = Socket::bind(&context, "0.0.0.0:8080").await?;
let socket = Socket::bind(&context, "0.0.0.0:8080").await?;
The socket bind operation is asynchronous and must be awaited. Ensure your runtime supports async operations.
  • Context - Required to create a socket
  • Engine - Consumes the socket when starting the engine
  • Error - Returns Error::SocketBind on failure

Build docs developers (and LLMs) love