A class in Alta.NetworkTransport.Runtime, Alta.NetworkingTransport.Kcp.
The KCP (reliable UDP) network transport the game uses by default. NetworkManager creates it from KcpSettings; both sides use it to open servers and client connections.
Constructors
Fields
4 private and internal fields
| Member | What it is |
|---|
private int channelCount | Number of channels created so far; the next channel ID. |
private readonly bool[] channelReliability | Whether each channel ID (up to 256) is reliable. |
private static readonly Logger Logger | NLog logger that the KCP library's info, warning and error logs are routed to (warnings log as errors). |
private readonly KcpSettings settings | The KCP settings passed to every server and client this transport creates. |
Properties
| Member | What it is |
|---|
int ByteOffset { get; } | Bytes reserved at the start of each packet buffer before game data; 1 for KCP. |
int PacketSize { get; } | Maximum packet size in bytes (1200). |
Events
| Member | What it is |
|---|
event Action<AltaNetworkError> OnError | Raised when the transport reports a network error. |
Methods
| Member | What it is |
|---|
ITransportClient Connect(string ipAddress, int port) | Client: starts a KCP connection to the given address and port and returns the client wrapper. |
int CreateChannel(bool isReliable) | Registers the next channel ID as reliable or unreliable and returns that ID. |
ITransportServer CreateServer(int port) | Server: starts a KCP server on the given port and returns the server wrapper. |
void Terminate() | Does nothing for KCP. |
KcpChannel ToKcpChannel(int channelId) | Maps a channel ID to KCP's reliable or unreliable channel, as set by CreateChannel. |
1 private and internal method
| Member | What it is |
|---|
private void FixNonAlloc() | Forces the KCP settings to non-allocating mode; called from the constructor. |
Used in
Members of other types that take, return or hold a KcpTransport: