Nebula
Transport

ITransport

Provides the network transport used by Nebula.

generated from the sources
public interface ITransport : IDisposable

Provides the network transport used by Nebula. Call Poll to receive events on the simulation thread. A transport can listen for incoming connections and connect to other processes, which lets a worker accept the gateway and worker peers while also connecting to peers.

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.

Flush

void Flush();

Push everything queued by Send onto the wire now instead of at the transport's next internal update. Call once per tick after the last Send, so a packet never waits for the sender's timer.

Stop

void Stop();

On this page