```c# using UnityEngine; using Unity.Jobs; using Unity.Collections; using Unity.Networking.Transport; struct ClientUpdateJob : IJob { public NetworkDriver driver; public NativeArray connection; public NativeArray done; public void Execute() { if (!connection[0].IsCreated) { if (done[0] != 1) Debug.Log("Something went wrong during connect"); return; } DataStreamReader stream; NetworkEvent.Type cmd; while ((cmd = connection[0].PopEvent(driver, out stream)) != NetworkEvent.Type.Empty) { if (cmd == NetworkEvent.Type.Connect) { Debug.Log("We are now connected to the server"); uint value = 1; var writer = driver.BeginSend(connection[0]); writer.WriteUInt(value); driver.EndSend(writer); } else if (cmd == NetworkEvent.Type.Data) { uint value = stream.ReadUInt(); Debug.Log("Got the value = " + value + " back from the server"); // And finally change the `done[0]` to `1` done[0] = 1; connection[0].Disconnect(driver); connection[0] = default(NetworkConnection); } else if (cmd == NetworkEvent.Type.Disconnect) { Debug.Log("Client got disconnected from server"); connection[0] = default(NetworkConnection); } } } } public class JobifiedClientBehaviour : MonoBehaviour { public NetworkDriver m_Driver; public NativeArray m_Connection; public NativeArray m_Done; public JobHandle ClientJobHandle; void Start () { m_Driver = NetworkDriver.Create(); m_Connection = new NativeArray(1, Allocator.Persistent); m_Done = new NativeArray(1, Allocator.Persistent); var endpoint = NetworkEndPoint.LoopbackIpv4; endpoint.Port = 9000; m_Connection[0] = m_Driver.Connect(endpoint); } public void OnDestroy() { ClientJobHandle.Complete(); m_Connection.Dispose(); m_Driver.Dispose(); m_Done.Dispose(); } void Update() { ClientJobHandle.Complete(); var job = new ClientUpdateJob { driver = m_Driver, connection = m_Connection, done = m_Done }; ClientJobHandle = m_Driver.ScheduleUpdate(); ClientJobHandle = job.Schedule(ClientJobHandle); } } ```