I have to receive data from diff clients on same port of server. I want to create separate channels for each client for this purpose and receive data on each of them.
I am exploring all the options available to design this.
Option 1 : Listen on a single socket and process the data coming from various devices.
Option 2 : Create multiple channels on same src address (in server) with diff remote addresses (of clients) and use a NIO selector to process data on these channels.
Option 1 seems bit risky as the remote devices are huge in number. And I can't seem to implement option 2. I get bind exception even though I am using setReuseAddress() API before binding the channel.
Can anyone help me here? Or if there is any better way to design this. I have explored other questions on stackoverflow but still I am not able to get proper understanding on whether it's feasible or not.