how to connect multiple clients to a single server....???
i hv a server and a client connected to each othr. and sending and receving data. through tcp/ip proto. now i want to make connections with other clients also.

plz help me..

Recommended Answers

All 6 Replies

use the accept() function to accept the new socket, and for every socket start a thread, which will listen and send.

You can use poll() or select() to listen on multiple sockets, so you can even use one thread for all the sockets.

read about accept, poll and select, also thread.

thanks a can we use poll() & select() in windows???

thanks......its usefull.

hw can a client send message to another client through server??? any idea.....thanks..

client creates a packet of data that contains the ip address of the destination clinent and the message. Send that packet to server. Server receives the packet, checks the destination ip address and forwards it on the that client.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.