vendredi 25 novembre 2022

multiple clients one tcp server select()

im a beginner to tcp client-server architecture. I am making a client server application in c++ I need the server to be able to accept messages from multiple clients at once. I used this IBM example as my starter for the server server: https://www.ibm.com/docs/en/i/7.1?topic=designs-example-nonblocking-io-select

the client side is irrelevent but this is my source client: https://github.com/bozkurthan/Simple-TCP-Server-Client-CPP-Example/blob/master/tcp-Client.cpp

the problem is with the server side it allows multiple clients to connect but not asynchronously, so the server will connect with the second client after the first one finishes. I want the server to watch for messages from both clients.

I tried to read about select() on the internet but I couldnt find anything to make the IBM code async. How can I edit the server code to allow the clients to connect and interact at the same time.

Aucun commentaire:

Enregistrer un commentaire