Nebula
Transport

ITransport

The seam between Nebula and whatever moves bytes.

generated from the sources
public interface ITransport : IDisposable

The seam between Nebula and whatever moves bytes. Sockets, reliability and sequencing are bought (LiteNetLib today), replication and authority are built on top. Poll-driven: nothing is raised outside Poll, so nothing mutates the world behind the simulation loop's back. A single transport can both listen and dial out, which is what workers need (they accept the gateway and their peers, and dial peers themselves).

Properties

Name

string Name { get; }

IsRunning

bool IsRunning { get; }

LocalPort

int LocalPort { get; }

Methods

Listen

void Listen(int port);

Bind and accept inbound links (port 0 = any free port).

StartClient

void StartClient();

Start listening on no particular port (dial-out only).

Connect

int Connect(string host, int port);

Dial a remote. Returns the peer id the link will use once connected.

Disconnect

void Disconnect(int peerId);

IsConnected

bool IsConnected(int peerId);

RoundTripMs

int RoundTripMs(int peerId);

Round trip in milliseconds as measured by the link, or -1 if unknown.

Send

void Send(int peerId, Delivery delivery, ArraySegment<byte> payload);

Poll

void Poll(Action<TransportEvent> handler);

Drain the socket and deliver every pending event to handler.

Stop

void Stop();

On this page