I am trying to set up a simple packet communication between a server and client. However, I keep getting this printing from the client console:
Cannot send data over the network (the number of bytes to send is greater than sf::UdpSocket::MaxDatagramSize)
This seems suspicious as I am sending very little data through these packets. Below is what I am using for network handling (for now):
NetworkHandler::NetworkHandler(IpAddress server, int serverPort, int myPort) : mThread(&NetworkHandler::handleNetworking, this)
{
mServerIp = server;
mServerPort = serverPort;
mMyPort = myPort;
mSocket.bind(myPort);
mThread.launch();
}
void NetworkHandler::handleNetworking()
{
cout << sf::UdpSocket::MaxDatagramSize << endl;
Packet p;
p << "newclient" << "charsmud";
Socket::Status s = mSocket.send(p, mServerIp, mServerPort);
while (true)
{
for (int i = 0; i < 10; i++)
{
if (i == 9)
{
Packet p2;
p << "pinger";
Socket::Status l = mSocket.send(p, mServerIp, mServerPort);
}
}
}
}
Both s and l both give back Done. I haven't run the for loop too many iterations, but l is giving me Done every time.