Reputation: 477
I need to use a lot of UDP Sockets pointing to different UDP ports for Receive function. Hence I have opened a lot of sockets and have used BeginReceive() to call the respective callback function when a frame arrives in the particular ports.
Is there a limit to the number of sockets that I can keep open, at a time?
Thank You
Upvotes: 1
Views: 2727
Reputation: 63772
Sure, there's always limits:
You'll find more examples, of course. But the port number limit is an absolute hard limit. Well, as long as you only have one IP address, of course. Nothing prevents you from having a few different network cards in your computer, or VPNs for example...
The more important question is "why?". UDP is message-based - it's actually quite easy to handle messages from thousands (and more) clients with just a single socket. Unlike TCP, UDP doesn't have any exclusive connections.
Upvotes: 4