Er, for 3), make that:

memcpy(buffer, packet->data, min(packet->dataLength, 500));
buffer[min(packet->dataLength, 500-1)] = '\0';

Lee

Lee Salzman wrote:
1) enet_host_broadcast IS implemented as sending the same exact packet to every connected peer. It's more just a convenience function for a very common usage than anything that is super-optimal.

2) packet->dataLength

3) memcpy(buffer, packet->data, min(packet->dataLength, 500)); buffer[500-1] = '\0';

Lee

Peter Soxberger wrote:
Hi!
I have 3 small but important questions:

1) Is enet_host_broadcast faster/better/... than sending a packet with enet_peer_send to every connected peer? 2) How can I get the real size of a sent packet so that I can calculate the duration (sizeof always returns 4 ^^)? 3) How do I get the whole content of a packet (if it's content is a non null terminated string) and save it into a char array? I always did it like this: sprintf_s(buffer,500,"%s",packet->data); but this only works with a null terminated string...

Thanks for your help!

Peter Soxberger

_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss


_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss

Reply via email to