Reputation: 212
I have 10.000 small device and those have one server port(waiting connection). I want to connect all devices at the same time with one Server(PC). Can I open port for each Device? Is it possible for Windows ? thnx
Upvotes: 2
Views: 1635
Reputation: 23916
The way to actually do this is to have the devices listen on a specific multicast group. This way you can just broadcast a packet and the machines listening to that group will (most likely) receive the packet.
This also give many benefits of dividing things into groups using multicast addresses.
Note that there is a possibility of lost packets - so I suggest sequence numbering/recovery method if every single message is important.
Upvotes: 0
Reputation: 388
As long as you used a reasonably efficient polling strategy (e.g. I/O completion ports, if you're using Windows) and keep the kernel socket buffers fairly small, it's possible in principle. However, if reliability is not a large concern, and you can control both ends of the protocol (i.e., you're designing the devices), UDP would be far more efficient - with UDP you could read from all devices using a single socket.
If TCP is a requirement, you'll have an absolute limit of 60,000 connections from a single interface because TCP port numbers are only 16 bits, i.e., 64k possible values. Eventually you'll run out of local port numbers, unless you do something exotic like giving your network interface more than one IP address.
Upvotes: 0
Reputation:
Read section 4.8 on this page. It looks like the answer is yes, in principle, but you need to do asynchronous IO, because you can't run 10000 threads on Windows at the same time.
Upvotes: 1