Open ksubox opened 2 years ago
Sending large data with UDP will always be much slower than with TCP, especially in less-than-ideal situations. I don't think ENet is designed to provide fast UDP file downloads.
It's likely you are not calling enet_host_service/enet_host_check_events often enough or in an optimal pattern.
I tested different patterns and last one is: while(true) { int evres = enet_host_service(host, &evt, 0); while (evres > 0) { // do some input processing - very light, just count incoming traffic evres = enet_host_check_events(host, &evt); }
if (peer->reliableDataInTransit > 512 * 500) continue; auto res = enet_peer_send(peer, 0, packet); }
And anyway speed almost the same (increased up to 2.5MBps from 2MBps).
So I believe problem is different from pattern usage. Could you hint where I should check in source code ?
I tested ENet library with 2 clients located far from each other: TTL 53, Ping 280 and got maximum bandwidth of reliable packets about 2Mbps With the same conditions I got about 9MBps with LiteNetLib (C#). And TCP gives about 9-10MBps between same clients. Local tests (localhost<->localhost) give about 300MBps. I guess something wrong with buffering or window processing.