A Server Side program in network
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: A Server Side program in network

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Posts
    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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,301

    Re: A Server Side program in network

    And what?
    Victor Nijegorodov

  3. #3
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,108

    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.

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,782

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center