public interface ITransportA way to move bytes between a server and its clients.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
One object holds both halves. A transport has a server half and a client half and either, both, or neither may be running. That is not tidiness: a listen server — one process that is both the host and a player — is the same transport with both halves started, and if the two halves were separate objects then host mode would be a second code path through every layer above. Here it is the same path with a loopback in it.
Nothing is delivered outside Poll. No callbacks arrive on a socket thread, no handler runs between two systems in a frame. The transport queues what happened and hands it over when the frame asks, which is what lets replication be ordinary code that runs at a known point in the schedule rather than code that has to be thread-safe against a network thread.
Time is a parameter, not a reading. Poll is told how much time has passed rather than asking a clock. A transport whose behaviour depends on time — retries, timeouts, the latency injected by NetworkSimulation — is then a pure function of the calls made to it, so a test that wants to observe a 200 ms round trip does it in a loop rather than in 200 ms, and observes the same thing every run.
Sending to something that is gone is not an error. A connection that dropped is not observed until the frame polls, so the frame that sends to it is behaving correctly with the information it has. Implementations drop such a send silently. Sending a payload larger than MaxPayloadBytes throws, because no information the caller could have had would make that right.
Fields and properties (3)
TransportCapabilities CapabilitiesWhat this transport can carry, and what it will not promise.
TransportState ServerStateWhether the server half is listening.
TransportState ClientStateWhether the client half is connected.
Methods (8)
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.
void StopServer()Stops listening and disconnects everyone, reporting ServerStopped to both sides. Does nothing if the server half is already stopped.
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".
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.
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.
void SendToClient(ConnectionId connection, ReadOnlySpan<byte> payload, Channel channel)Sends to one connected client. Does nothing if the connection is not ours.
void SendToServer(ReadOnlySpan<byte> payload, Channel channel)Sends to the server. Does nothing if the client half is not connected.
void Poll(TimeSpan elapsed, ITransportEvents events)Advances the transport by and reports everything that has happened since the last call, in the order it happened, to .
Used by (24)
- GameClientMultiplayer
- GameServerMultiplayer
- LocalMatchMultiplayer
- CompositeOverLocalConformanceTestsVixen.Net.Transport.Composite.Tests
- CompositeTransportVixen.Net.Transport.Composite
- HarnessVixen.Net.Tests
- InjectingTransportVixen.Net.Fuzz
- LocalTransportVixen.Net.Transport.Local
- LocalTransportConformanceTestsVixen.Net.Tests
- NetworkSessionVixen.Net
- NetworkSimulationVixen.Net
- NetworkSimulationTestsVixen.Net.Tests
- PeerVixen.Net.Tests
- SessionHarnessVixen.Net.Tests
- SessionRpcTransportVixen.Net
- SimulatedTransportConformanceTestsVixen.Net.Tests
- TransportConformanceVixen.Net.Tests
- UdpTransportVixen.Net.Transport.Udp
- UdpTransportConformanceTestsVixen.Net.Transport.Udp.Tests
- WebSocketTransportVixen.Net.Transport.WebSocket
- WebSocketTransportConformanceTestsVixen.Net.Transport.WebSocket.Tests
- FakeBuildVixen.Editor.Debugger.Tests
- RemoteInspectorClientVixen.Editor.Debugger
- RealmVixen.Live.Realm