Writing some async network functions.
With the receive method, currently it's a vector array which contains the size of the data.
What if it's just a pointer to a block of memory ?
Will the receiver always know the size or should I include it
Ian wrote:Writing some async network functions.
With the receive method, currently it's a vector array which contains the size of the data.
What if it's just a pointer to a block of memory ?
Will the receiver always know the size or should I include it
Ian wrote:Well currently it just appends the packet size to the start of the data.
That makes receiving the whole data chunk much simpler
I think I'm just going to return a vector of vectors, hopefully that won't blow Spindizzi's mind
Just trying to work out how to properly use std::move so as to avoid pointless copies
if (recv_size < 0x0019) // must find a better condition
{
//auto recv_data = udpReceive.ReadData(5000);
//DebugLog("-> nb recu : %x\n", recv_data.size());
//memcpy(CommRAM + recv_offset, recv_data.data(), recv_data.size());
//DebugLog("receive enable off=%x size=%x\n", recv_offset, recv_size);
DebugLog("receive enable off=%x size=%x\n", recv_offset, recv_size);
auto &recv_data = netr->Receive();
memcpy(CommRAM + recv_offset, recv_data.data(), recv_data.size());
}
else
{
DebugLog("receive enable original value off=%x size=%x\n", recv_offset, recv_size);
slot = (recv_size >> 12) & 0x0f;
recv_size = recv_size & 0x0fff;
recv_size = (recv_size << 4) | ((recv_size >> 8) & 0x000f);
recv_size = recv_size & 0x0fff;
if (slot != 0)
{
recv_size = recv_size * slot;
}
recv_offset = (recv_offset << 8) | (recv_offset >> 8);
//DebugLog("receive enable off=%x size=%x slot=%x\n", recv_offset, recv_size, slot);
//auto recv_data = udpReceive.ReadData(5000);
auto &recv_data = netr->Receive();
DebugLog("-> nb recu : %x\n", recv_data.size());
memcpy(CommRAM + recv_offset, recv_data.data(), recv_data.size());
}
Ian wrote:Just tested scud and it works great
Do you want me to push these changes? Also did you want to get added to the project so you can commit your own changes?
Users browsing this forum: No registered users and 1 guest