Multithreaded client server problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Multithreaded client server problem

  1. #1
    Join Date
    Sep 2011
    Posts
    3

    Multithreaded client server problem

    I am facing a peculiar problem with my clients server application. I have written a console based multithreaded client server. Multiple Client try to send and receive data thousand times. When i run more than one client, my old client stops sending receiving data and new client starts operation. I am unable to understand why my first client gets blocked when i start another client.

  2. #2
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,553

    Re: Multithreaded client server problem

    You probably have an error in your code.

    Seriously, what else can we guess/surmise, based on the meager description that you provided.

    The error might lie with the server, in that the server stops servicing older clients when a new client arrives. Go to the "Multithreaded Server" example at http://tangentsoft.net/wskfaq/exampl...ed-server.html and compare your code to the sample

    Mike

  3. #3
    Join Date
    Sep 2011
    Posts
    13

    Re: Multithreaded client server problem

    i'll tell you whats your problem

    since you got multiple clients, you need multiple FD's to set
    if you don't set the FD on the client (server-side talking) and try to send( ) on that socket, it will not work.

    what you need to do is enumerate all your clients into a container and set the FD's on their socket and have a variable to define the number of fd's you have totally set.

    after that you can try to select( ) on all the sockets (easiest way)

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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center