libinzhangyuan / reliable_udp_bench_mark Goto Github PK
View Code? Open in Web Editor NEWTest reliable udp for situation of realtime pvp game by wireless.
License: GNU General Public License v2.0
Test reliable udp for situation of realtime pvp game by wireless.
License: GNU General Public License v2.0
There is a socket bug in your client both dgram and stream. you should not bind the client socket with the client fd. for example:
// bind
sockaddr_in my_addr;
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(local_port_);
my_addr.sin_addr.s_addr = INADDR_ANY;
std::memset(&(my_addr.sin_zero), '\0', 8);
if (UDT::ERROR == UDT::bind(sock_, (sockaddr*)&my_addr, sizeof(my_addr)))
{
std::cout << "UDT bind: " << UDT::getlasterror().getErrorCode() << ' ' << UDT::getlasterror().getErrorMessage() << std::endl;
return -1;
}
The problem with the bug:
1.when you start the client first,
2.start the server.
3.your tester can not work.
The reason is that the new fd binding in the client covered the server's fd. and it maybe not appear which the client and server are on different machines. what's more, binding a address and using another address is not a correct way.
You set ENet to 56k down per sec. thats kbits, not kbytes. thats only 7Kbytes ber second. And 14k up (14kbits, or 1.75 Kb). You then try to send 500 bytes per 50ms, which is 10,000 bytes. That doesn't leave enough for protocol messages without needless delay, especially with the upload set so low.
Also, UDT buffers data to send it in large packets using the do-not-fragment flag. The result is more latency and but much higher throughput. It was designed to send GB of data per second between satellites in a day that such speeds where unheard of. If not set right it will consume huge amounts of CPU. That's not a bug, just the result of UDT spinning in a tight loop between sending data. These gaps allow the buffer to fill in order to maximize throughput, rather than repeatedly calling send on individual packets.
Also, your running KCP using multiple threads, one example using pthreads and another via boost asio. They are not delayed as the ENet client was. Why you would use multiple undelayed clients vs one that is delayed is beyond confusing.
如题,这个对比是基于弱网络环境的测试,那么这个弱网络环境的参数是什么?比如丢包率多少?网络固定延迟多少?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.