Hello! I did not know where else to post this question as it seems DarkNet does not have it's own section/site so here it goes ;P
I am trying to send a bunch of integers using the following code,
void StreamSector( size_t ConnID, PolyVox::Vector3DFloat PlayerPos )
{
PolyVox::Vector3DInt16 VoxelPos_World = WorldPosToVoxelPos(PlayerPos);
std::cout << "Stream Sector: " << VoxelPos_World.getX() << " " << VoxelPos_World.getY() << " " << VoxelPos_World.getZ() << std::endl;
DayX_Sector* Sector = GetSectorFromVoxelPos( VoxelPos_World );
if ( Sector != nullptr )
{
for( std::vector<DayX_Chunk*>::iterator Chunk = Sector->Chunks.begin(); Chunk != Sector->Chunks.end(); ++Chunk )
{
//Sending Chunk Data Packet
mn::AddSizeT( sendPacket, OP_LOADCHUNK );
//Chunk Region Lower Corner
mn::AddInt( sendPacket, (*Chunk)->Blocks.getLowerX());
mn::AddInt( sendPacket, (*Chunk)->Blocks.getLowerY());
mn::AddInt( sendPacket, (*Chunk)->Blocks.getLowerZ());
//Chunk Region Upper Corner
mn::AddInt( sendPacket, (*Chunk)->Blocks.getUpperX());
mn::AddInt( sendPacket, (*Chunk)->Blocks.getUpperY());
mn::AddInt( sendPacket, (*Chunk)->Blocks.getUpperZ());
//Fill Density Value For Each Block
/*for ( int x = (*Chunk)->Blocks.getLowerX(); x <= (*Chunk)->Blocks.getUpperX(); ++x )
{
for ( int z = (*Chunk)->Blocks.getLowerZ(); z <= (*Chunk)->Blocks.getUpperZ(); ++z )
{
for ( int y = (*Chunk)->Blocks.getLowerY(); y <= (*Chunk)->Blocks.getUpperY(); ++y )
{
PolyVox::MaterialDensityPair44 Voxel = volData->getVoxelAt( x, y, z );
uint8_t Density = Voxel.getDensity();
mn::AddUnsignedInt( sendPacket, Density);
}
}
}*/
//Send TCP Packet To Client
std::cout << "SEND SECTOR - ";
mn::SendTCP( 0,sendPacket,ConnID,false,false );
std::cout << "SENT" << std::endl;
}
} else {
std::cout << "NULL Sector" << std::endl;
PolyVox::Vector3DInt16 Pos = PolyVox::Vector3DInt16( WorldPosToVoxelPos(PlayerPos) );
GenerateSector( Pos.getX(), Pos.getY(), Pos.getZ() );
StreamSector( ConnID, PlayerPos );
return;
}
}
As you can see I've commented out the three for loops, if I uncomment them as soon as the message sends my client disconnects, I can reconnect the client and go through the process again but unless the for loops are commented out the message never fully gets to the client and the client always disconnects.
The server reports it fully sends the packet yet the client gets no message of a packet received it simply disconnects.
I have messed with the sendPacket SetMemorySize and increasing it considerably seems to hold no effect.
Making the loops only loop 6 times instead of 7 the message sends fine and the client receives it although this is very minimal data and I will need to send more information in this particular packet in the future.
How can I make it so I can send more data at once?
Is there a limit on how many integers you can send in one packet?
Maybe I found a bug as nobody has ever tried to send this much data (although it doesn't seem like it's that much at all really)
Thank you for your help as always it is greatly appreciated!