Client/Server Client/Client Connection
Hi,
i'm working on a 3D Chat (WINSOCK and C++) and i need to know some suggest about a Public Chat and a Private Chat. For Example:
In public chat i can send all message to server and the server send this messages to all client connected. And there i've no problem.
The problem is when i try to connect two client for a private chat. In a private chat the messages don't will go to the server, but the messages are sended directly to another client. So i've implemented a thread for a "little server" into the client. But i've some problem with the port.
I need to know where i can learn something about this tecnique. Thanks a lot. And sorry for my bad english!
You could just have a flag in the packet (if its private) and only send that message to the correct person instead of broadcasting it to everyone else.
Edit: All of which would pass through the server.
Edit: All of which would pass through the server.
Quote:Original post by Imgelling
You could just have a flag in the packet (if its private) and only send that message to the correct person instead of broadcasting it to everyone else.
Edit: All of which would pass through the server.
Yes ok, that's work fine. But i need a peer to peer connection to send data like WebCam Streaming or Audio streaming. So i can't use the server to send this data type.
I've another problem: When i try so send multiple message to all client connected to my Server, i lost some messages. I use a structure like this:
for(itl = m_SClient.begin(); itl != m_SClient.end(); ++itl) { iStat = send(sRecSocket, msg.c_str() , msg.size()+1, 0); cout<<iStat<<"\n"; }
And... if you send it like this, in a for loop, and you are using udp, you probalby is using more bandwith than you have avaliable, it causes more packets to be drop than the usual.
Quote:Original post by Tano_ITA
I've another problem: When i try so send multiple message to all client connected to my Server, i lost some messages. I use a structure like this:
TCP or UDP? Blocking or non-blocking?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement