CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Location
    NC
    Posts
    2

    Question Multithreaded TCPClient

    I have setup a simple TCPListener and TCPClient that runs in a background thread on a server app. It works fine and connects correctly to clients and fetches messages. I wish to make this multithreaded so that as each client connects a new thread is created rather than having to wait for the single background thread to finish and process the next connection request.

    I have tried several ways to do this and always wind up with a vicious loop of thread creation and no processing.

    I would greatly appreciate a pointer to an article or snippet that will get me moving in a positive direction again.

    Thx for your help

    Archie



  2. #2
    Join Date
    May 2002
    Location
    Atlanta,GA
    Posts
    262

    Re: Multithreaded TCPClient

    Originally posted by aspivey
    I have setup a simple TCPListener and TCPClient that runs in a background thread on a server app. It works fine and connects correctly to clients and fetches messages. I wish to make this multithreaded so that as each client connects a new thread is created rather than having to wait for the single background thread to finish and process the next connection request.

    I have tried several ways to do this and always wind up with a vicious loop of thread creation and no processing.

    I would greatly appreciate a pointer to an article or snippet that will get me moving in a positive direction again.

    Thx for your help

    Archie

    I believe that I've already responded to this post in another forum and recommended that you use Asynchronus I/O for it but I found a decent set of power point slides on multithreading in the .NET environment so here's the link. http://www.renaissance.co.il/ivbug/m...ithreading.ppt
    Jared

  3. #3
    Join Date
    Jun 2002
    Location
    NC
    Posts
    2
    Thanks Jared,

    Yes, you did respond and I digested your posting content. I did a quick and dirty with the sockets client and it seems to be blocking. I'm running a client connect on another box and when it connects to the server socket, it will not connect for another exchange until the previous one has cleared.

    I need to be able to instantiate a new thread for each connection whether it be a tcpclient connection or a socket connection. The app that I'm having to build will not have a callback. The clients are a moving target as they connect and disconnect quickly. They identify themselves with a unique ID string. I do some work for the client that is identified in the message also. The unique ID is used later to send the result of the work event back to them. The client is using a radio interface that connects via a TCP port. The client MUST connect/disconnect fast.

    Thanks for your help Jared,

    Archie

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