Comments (4)
udp connect is actually not very useful. It just sets the address of the other end, so you can call the write and send functions (without using sendto).
One udp port corresponds to one fd, so it can only correspond to one thread. Therefore, to improve the performance of udp, it is usually solved by using multiple udp ports.
udp connect 其实并没什么用 只是设置下对端的地址 这样可以调用write和send函数(而不用sendto).
一个udp端口对应一个fd,所以一般只能对应一条线程。所以要提高udp的性能,一般通过多个udp端口解决。
TRANS_BY_GITHUB_AI_ASSISTANT
from zltoolkit.
In a TcpServer, a tcp port has a listen fd. After receiving an accept event, it can create multiple peerfds.
This listen fd is monitored by multiple threads, and multiple threads can accept simultaneously. After a successful accept, there is a peerfd, which will be bound to the accept thread.
TcpServer中,一个tcp端口,有一个listen fd, 在收到accept事件后,能创建多个peerfd。
这个listen fd是多个线程监听的,可以多个线程同时accept,accept成功后有有一个peerfd,这个peerfd会 绑定到这条accept线程
TRANS_BY_GITHUB_AI_ASSISTANT
from zltoolkit.
In other words, a TCP server with a single port can utilize the performance of a multi-core CPU, but a UDP server with a single port can only utilize the performance of a single thread.
也就是说 tcp服务器单端口能发挥多核cpu的性能,但是udp单端口只能发挥单条线程的性能
TRANS_BY_GITHUB_AI_ASSISTANT
from zltoolkit.
Understood, thanks for the explanation.
了解了, 多谢解答.
TRANS_BY_GITHUB_AI_ASSISTANT
from zltoolkit.
Related Issues (20)
- SSL multithreading support issue seeking help HOT 2
- It seems like the CPU load statistics for the thread pool are incorrect. HOT 1
- UDP data may be misread. HOT 1
- QQ group not found
- error C2988: unrecognized template declaration/definition HOT 1
- Poller and Timer Issues
- Question: Why does Ubuntu 16.04 compilation fail? HOT 1
- Discussion about the poller thread
- About the issue of TcpServer actively exiting HOT 1
- zltookkit Usage
- Technical Consultation: modifyEvent prompts Invalid argument HOT 12
- When using Windows, an exception "addEvent | select() can not watch fd bigger than 1024" was thrown when creating a TcpServer. HOT 2
- Is the use of Buffer correct in the `test_tcpEchoServer.cpp` example? HOT 9
- Can it be added with websocket and http support? HOT 1
- Does `SSL_Box`'s `_read_bio` and `_write_bio` leak memory if they don't release memory with `BIO_free`? HOT 2
- About the bug of Socket::enableRecv used in epoll edge mode HOT 9
- Send function multithreading deadlock issue HOT 1
- test_pingpong performance test, gigabit network card bandwidth, under 80% of bandwidth, why does the test frequently encounter socket send timeout HOT 5
- setReuseable sets whether the socket fd is written in reverse. HOT 6
- Potential inconsistency in BufferRaw::setCapacity method HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zltoolkit.