CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    23

    Asynchronous vs Synchronous sockets.

    Which is better suited to what? It makes sense that synchronous sockets need to be run using threads, and that asyncronous doesn't. But can a server setup with asynchronous sockets handle more connections/load then an a server with synchronous sockets? Consider the following situation:

    [--snip---]
    A server will handle a high volume of people that will be connected to the server over a long period of time. There isn't a lot of traffic that will be going back and forth, but there is the potential of a lot of traffic.
    [--snip---]

    The socket code could be setup to be synchronous, and each connection is sitting on it's on thread. Any packets that come in, are posted to a message que that the main thread reads from.

    Or

    The socket code could be setup to be asynchronous, and each connection sits in a list of connections. Any packets that come in, are posted to a message que that the main thread reads from.

    What would be the best way of approaching this?

    Thanks
    Orion


  2. #2
    Join Date
    May 1999
    Posts
    5

    Re: Asynchronous vs Synchronous sockets.

    Orion,
    Usage of asynchronous or synchronous depends on your requirement. if the protocol using which you would be communicating is synchronous such as ftp which maintains a session of who ever is logged in the implementation is easier using synchronous sockets.
    In case of http protocols asynchronous sockets would be a easier implementation.
    Also be careful when you use threads with MFC Socket abstraction classes. You cannot pass a instance of CSocket across the thread.
    Samir


  3. #3
    Join Date
    May 1999
    Posts
    23

    Re: Asynchronous vs Synchronous sockets.

    I'm designing both the client and the server, so it's just a matter of figuring out which is a better implimentation, and how many threads and sockets NT can have.

    Orion


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured