public sealed class LocalTransportA transport with no socket in it: server and clients in one process, talking over queues.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
This is the transport the rest of the networking stack is developed and tested against, and it is a shipping transport rather than a test double. Offline play is a client and a server on one LocalNetwork; a listen server is one transport with both halves started, connected to itself. Both use the same session, replication and RPC code a dedicated server uses, so "it works in single player" and "it works in multiplayer" stop being two different claims.
It is a perfect wire, on purpose. Nothing is lost, duplicated or reordered, and every channel is therefore honoured for free. Imperfection belongs to NetworkSimulation, which wraps this and injects it deliberately with a seed — a transport that was unpredictably slightly wrong would make every test above it unpredictably slightly flaky.
Delivery still costs a poll. A payload sent now is reported by the receiver's next Poll, not inside the send. Making the in-process path synchronous would make it the one transport whose ordering the layers above could not be tested against.
Sends and connects are thread-safe. Poll is not reentrant and is meant to be called from one thread — the frame owns it.
Fields and properties (7)
public const int MaxPayloadBytesThe largest payload this transport carries, in bytes.
public string AddressThe address the server half binds, and the client half looks for.
public LocalNetwork NetworkThe network both halves reach each other through.
public TransportCapabilities CapabilitiesWhat this transport can carry, and what it will not promise.
public TransportState ServerStateWhether the server half is listening.
public TransportState ClientStateWhether the client half is connected.
public int ConnectionCountHow many clients the server half currently has.
Methods (10)
public LocalTransport(LocalNetwork network, string address = "local")Creates a transport on a network.
public void StartServer()Starts listening. Where — a port, an address, a relay — was fixed when the transport was constructed, which is what keeps this interface free of anything socket-shaped.
public void StopServer()Stops listening and disconnects everyone, reporting ServerStopped to both sides. Does nothing if the server half is already stopped.
public void StartClient()Begins connecting. Completion is reported to OnConnected on a later Poll, or refusal to OnDisconnected — never inline, so the caller has one code path for "connected in a microsecond over loopback" and "connected in 90 ms over the Atlantic".
public void StopClient()Disconnects the client half, reporting Requested to this side and RemoteRequested to the server. Does nothing if the client half is already stopped.
public void Disconnect(ConnectionId connection)Closes one connection from the server side, reporting Requested here and Kicked there. Does nothing if the connection is not one of ours.
public void SendToClient(ConnectionId connection, ReadOnlySpan<byte> payload, Channel channel)Sends to one connected client. Does nothing if the connection is not ours.
public void SendToServer(ReadOnlySpan<byte> payload, Channel channel)Sends to the server. Does nothing if the client half is not connected.
public void Poll(TimeSpan elapsed, ITransportEvents events)public void Dispose()Stops both halves and releases every payload still queued.
Used by (18)
- LocalMatchMultiplayer
- CompositeOverLocalConformanceTestsVixen.Net.Transport.Composite.Tests
- CompositeTransportTestsVixen.Net.Transport.Composite.Tests
- HarnessVixen.Net.Tests
- LocalNetworkVixen.Net.Transport.Local
- LocalTransportConformanceTestsVixen.Net.Tests
- LocalTransportTestsVixen.Net.Transport.Local.Tests
- NetworkSimulationTestsVixen.Net.Tests
- ReentrantPollerVixen.Net.Transport.Local.Tests
- RpcOverSessionTestsVixen.Net.Tests
- SessionHarnessVixen.Net.Tests
- SessionTestsVixen.Net.Tests
- SimulatedTransportConformanceTestsVixen.Net.Tests
- DiagnosticsModuleVixen.Editor.Diagnostics
- RemoteInspectorTestsVixen.Editor.Debugger.Tests
- RealmVixen.Live.Realm.Tests
- RealmClusterTestsVixen.Live.Realm.Cluster.Tests
- RealmFixtureVixen.Live.Realm.Tests