public ReceiveData ( byte &data, int size ) : int | ||
data | byte | |
size | int | |
return | int |
protected virtual void MessageReceivedHandler(int NumberOfAvailableData) { byte[] data = new byte[NumberOfAvailableData]; listener.ReceiveData(ref data, NumberOfAvailableData); string message = Encoding.ASCII.GetString(data, 0, data.Length); messageQueue.Enqueue(message); }
//Handles the reception of 1 UDP packet of data. public void ReceivedHandler(int NumberOfAvailableData) { int PacketSize = Packet.GetHeaderSize() + Packet.DEFAULT_PACKET_SIZE; if (NumberOfAvailableData >= PacketSize) { while (aUDPListener.GetNumberOfReceivedData() >= PacketSize) { byte[] buffer = new byte[PacketSize]; aUDPListener.ReceiveData(ref buffer, PacketSize); Packet p = new Packet(buffer); PacketReconstructors.ReconstructFile(p); } } }