Struct IPCNetworkInterface
The IPC network interface implements the functionality of a network interface over an
in-memory buffer. Operations will be instantaneous, but can only be used to communicate with
other Network
Note that the interface expects loopback addresses when binding/connecting. It is
recommended to only use Loopback
Inherited Members
Namespace: Unity.Networking.Transport
Assembly: solution.dll
Syntax
[BurstCompile]
public struct IPCNetworkInterface : INetworkInterface, IDisposable
Examples
This example code establishes an in-process communication channel between two drivers:
var driver1 = NetworkDriver.Create(new IPCNetworkInterface());
driver1.Bind(NetworkEndpoint.LoopbackIpv4.WithPort(1));
driver1.Listen();
var driver2 = NetworkDriver.Create(new IPCNetworkInterface());
driver2.Bind(NetworkEndpoint.LoopbackIpv4.WithPort(2));
var connection2to1 = driver2.Connect(NetworkEndpoint.LoopbackIpv4.WithPort(1));
// Need to schedule updates for driver2 to send the connection request, and for
// driver1 to then process it. Since this all happens in-memory, one update is
// sufficient to accomplish this (no network latency involved).
driver2.ScheduleUpdate().Complete();
driver1.ScheduleUpdate().Complete();
var connection1to2 = driver1.Accept();
Properties
Name | Description |
---|---|
Local |
Gets the local endpoint that the interface will use to communicate on the network.
This call only makes sense after Bind(Network |
Methods
Name | Description |
---|---|
Bind(Network |
Binds the network interface to an endpoint. This is meant to act the same way as the
|
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
Initialize(ref Network |
Initialize the network interface with the given settings. |
Listen() | Start listening for incoming connections. Unlike Bind(Network |
Schedule |
Schedule a receive job. This job's responsibility is to read data from the network and
enqueue it in Receive |
Schedule |
Schedule a send job. This job's responsibility is to flush any data stored in
Send |