internal ClientInternal(NetworkManager manager, int clientIndex) { Client = new Client(clientIndex, 0); ReceiveEventArgs.Completed += (o,e) => manager.Callback_Receive(this); SendEventArgs.Completed += (o, e) => manager.Callback_DataSent(this); }
/// <summary> /// Gets <see cref="ClientInternal"/> that is identified by given client. /// </summary> /// <param name="client">Client which identifiest the <see cref="ClientInternal"/></param> /// <returns>The <see cref="ClientInternal"/>.</returns> internal ClientInternal GetClientInternal(Client client) { var clientInternal = _clientSlots[client.Index]; if (clientInternal.Client.Key != client.Key) //client is not available yet return null; return clientInternal; }
/// <summary> /// Fires event that handles client sending. /// </summary> /// <param name="client">Client whom the data will be sent.</param> /// <param name="block">The data to send.</param> /// <param name="dataOffset">Offset where data in block starts.</param> /// <param name="dataSize">Size of data to send.</param> private void Fire_Send(Client client, Block block, int dataOffset, int dataSize) { var evt = _dataSendEvents.GetEvent(); evt.Client = client; evt.Block = block; evt.DataOffset = dataOffset; evt.DataSize = dataSize; _iochannel.EnqueueEvent(evt); }
/// <summary> /// Sends given block to given client. /// </summary> /// <param name="client">Client whom the data will be sent.</param> /// <param name="block">Block that will be sent.</param> /// <param name="dataOffset">Offset where data in block starts.</param> /// <param name="dataSize">Size of data to send.</param> public void Send(Client client, Block block, int dataOffset, int dataSize) { Fire_Send(client, block, dataOffset, dataSize); }
/// <summary> /// Disconnects given client from the current pool. /// </summary> /// <param name="client">Client which will be disconnected.</param> public void Disconnect(Client client) { throw new NotImplementedException(); }