Sign in to follow this  
jameslys

Winsock2 multiple threads multiple UDP sockets

Recommended Posts

jameslys    100
Can I know that whether i can use multiple threads to send data through multiple udp sockets to the far side? I mean each threads has its own udp socket and independent from each others. In the receiving site, is it possible to use multiple threads to receive data from multiple udp sockets with each threads handles one independent udp socket? I am using winsock2.

Share this post


Link to post
Share on other sites
hplus0603    11347
If the source machine and destination machine is the same, what are you attempting to gain by using multiple sockets? There is only a single network card, and a single network wire, between the two machines.

In general, though, yes, you can use different sockets from different threads. One thread per request generally scales poorly, though, when you get into thousands or tens of thousands of connections.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this