Multiple Client Connections
Up until now i have only needed my server to handle one client connection at a time. But i am now working on a bigish chat server program and i am unsure how to have more that one client connected at a time.
Is it somthing to do with the number of backlog connections?
At the moment i am using:
#define BACKLOG 1
So i assume if i did
#define BACKLOG 6
Then i could have 6 connections waiting?, Although i woudnt want them waiting, i need them all connected at once.
Also how would i handle each connection individually? Say for instance on the chat server there were 4 people connected. How would i then get say the 3rd persons IP so he could be disconneted.
Because at the moment i am handling all my connections on 1 socket:
sock2 = accept(sock1,(struct sockaddr *)&client,&sin_size);
And sock1 is listing for connections.
I have tried to make that clear, but basically i need to adjust my code from taking and clearly handling 1 connetion from a client to taking up to say 15 potential client connections.
Thanks for any help,