-
March 23rd, 2014, 11:41 AM
#1
A Server Side program in network
A server side application listening at multiple ports simultaneously(we can take 1000, but the solution should be scalable to any number of ports). On receiving packet at any port, the application should echo back the packet to sender
-
March 23rd, 2014, 12:22 PM
#2
Re: A Server Side program in network
And what?
Victor Nijegorodov
-
March 26th, 2014, 09:32 AM
#3
Re: A Server Side program in network
A scalable server, this looks like a task for IO Completion Port. My first thought was about ::select(), but that cannot handle a large number of sockets, IIUC.
-
March 27th, 2014, 07:56 AM
#4
Re: A Server Side program in network
there's no problem with select() per se, but since it's typically a blocking call, it means any solution using it will need a separate thread per connection.
ANd then you get into the whole issue about overhead for threads and all the nasties when you have (significantly) more threads than you have CPU cores.
You could use select() without timeout, but that'll mean cascading a series of select calls one after the other which has all sorts of nasties of it's own.
You can combine the above two in a hybrid solution which adds complexity and management issues.
You can make a select() solution work, even with a couple Thousand ports, but it'll typically put quite a strain on the server. depending on the I/O/CPU needs, it may work if your server's performant enough.
But yes, as you said, with a description of "1000 ports or up to any number", IO completion ports are the better path. But this path will take quite a bit more work and forethought than just scaling up a '1 way communication' solution a Thousand times.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|