Client/Server

Post questions regarding programming in C/C++ in Linux/Unix.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

Client/Server

Postby morris » Wed Aug 20, 2008 10:03 pm

Hello, I made a simple server/client communication, through sockets and using forks on each connection.
It's supposed to work like a chat, but I couldn't find a way for sending the message to all the connected clients, I can only write on the open socket in that child.
I searched around, but I could only found libs and wrappers, that make things messy.

It would be good if I can treat multiple in/outputs without waiting between them.
morris
 
Posts: 7
Joined: Wed Jun 11, 2008 12:54 am

Postby ventsyv » Wed Sep 03, 2008 4:05 pm

You have a main class/form whatever, from where you fork all connections right ? You should be able to loop through all open processes and send the message on each one. You do have handles to those in your main right ?
User avatar
ventsyv
 
Posts: 2810
Joined: Mon Sep 22, 2003 5:25 pm
Location: MD USA

Postby morris » Wed Sep 03, 2008 8:06 pm

Oh, sorry, I forgot about this topic.
I already solved that problem using a POOL.

I'm learning about sockets, so I've another problems now (but this one is solved).
Thanks :D
Your idea using pipes work too, but blocks input.
morris
 
Posts: 7
Joined: Wed Jun 11, 2008 12:54 am


Return to Unix/Linux

Who is online

Users browsing this forum: No registered users and 0 guests