Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Bytes sent is greater than MaxDatagramSize  (Read 2322 times)

0 Members and 1 Guest are viewing this topic.

Charsmud

  • Newbie
  • *
  • Posts: 30
    • View Profile
Bytes sent is greater than MaxDatagramSize
« on: March 11, 2017, 03:57:08 am »
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):

Code: [Select]
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.

Charsmud

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Bytes sent is greater than MaxDatagramSize
« Reply #1 on: March 11, 2017, 04:02:59 am »
Ignore this, I figured out my issue... I mistyped and was writing to p instead of p2. 

 

anything