Hey,
Iv just started using IrrNetLite and networking in general
Iv been making a client and server but iv run into problems with sending and recieving packets, the client can connect to the server with no problems but when i try to send a packet the server never receives it
shouldnt
char* buffer[1000];
be
char buffer[1000];
also, put some debugging info in there to see what is happening...
NetworkClass::Handle(irr::net::InPacket * packet)
{
printf("Handle()\n");
if (packet!=NULL) printf("Handle is valid\n");
c8 packetid;
char* buffer[1000];
packet->resetPos();
packet->getNextItem(packetid);
printf("checking if packet ID == 50\n");
if(packetid == 50)
{
printf("packet ID is 50\n");
packet->getNextItem((char*)buffer);
cout << (char*)buffer << endl;
packet->getNextItem((char*)buffer);
cout << (char*)buffer << endl;
}
else printf("packet ID is NOT 50\n");
Note: If you send out a packet unreliably, there is no guarantee your server will ever receive that packet. For something like a login packet, why don't you send it reliably so you know that it'll get there eventually.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
Found the source of the problem, rather stupid - i forgot to put update in the clients loop
Note: If you send out a packet unreliably, there is no guarantee your server will ever receive that packet. For something like a login packet, why don't you send it reliably so you know that it'll get there eventually.
Yeah thats because i was just trying it out to see if it would make a difference.
shouldnt
char* buffer[1000];
be
char buffer[1000];
I dont know but thats what was being used in some tutorials i read on these forums