Is it possible to write about 300 integers into a packet and send it over the network and unpack it successfully, using UDP and SFML 1.3? Is there a limit on the size of a packet in this version? If I try to send all the data in one packet it fails at extracting the data when the packet is received. If I write about 1/6th of the data to a packet it successfully extracts the data. I would like to send at least the 300 integer values in one packet.
class Network_Tetris_Packet
{
public:
sf::Int32 filled_c[ROWS][COLS];
}
sf::Packet& operator << (sf::Packet &packet, const Network_Tetris_Packet &tet_packet)
{
for(int i = 0; i < ROWS; i++)
{
for(int j = 0; j < COLS; j++)
{
if(packet << tet_packet.filled_c[i][j])
// Insertion into packet successfull
else
// Insertion into packet not successfull
}
}
return packet;
}
sf::Packet& operator >> (sf::Packet &packet, Network_Tetris_Packet &tet_packet)
{
for(int i = 0; i < ROWS; i++)
{
for(int j = 0; j < COLS; j++)
{
if(packet >> tet_packet.filled_c[i][j])
// Extraction from packet successfull
else
// Extraction from packet not successfull
}
}
return packet;
}
main
{
//..
sf::Packet send_packet;
sf::Packet receive_packet;
Network_Tetris_Packet tet_packet;
// Pack game data into packet
send_packet << tet_packet;
// Send game data to peer
status = Client.Send(send_packet,peer_ipAddress,outPort);
send_packet.Clear();
// Receive game data packet from peer
status = Client.Receive(receive_packet,dumb_address);
// Unpack game data from received packet
receive_packet >> tet_packet2;
receive_packet.Clear();
//..
}