Network Servers - whose connected to me?
I'm using Cocoa and BSD APIs. OK, this is the last networking question I have I swear, but I really appreciate the help.
So a few clients are connected to a server -- it's all great but, now if the server wants to send some data to ALL or SOME of the clients connected how do you do that?
Something tells me just pain write() isn't going to cut it.
Explaining this by an algorithm is fine.
So a few clients are connected to a server -- it's all great but, now if the server wants to send some data to ALL or SOME of the clients connected how do you do that?
Something tells me just pain write() isn't going to cut it.
Explaining this by an algorithm is fine.
Your best choice (I think) would be to keep an array of all open sockets by file descriptor. Loop over them, and write() to all of them. Either that or broadcast messages over TCP or UDP, although that may be more pain than it's worth.
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
The descriptor is what's returned by socket() and accept().
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| java network api | San_Andreas | 1 | 2,888 |
May 1, 2008 08:05 AM Last Post: AndyKorth |
|
| Getting network connection for a specified PID | Florian | 6 | 4,524 |
Dec 23, 2006 03:46 AM Last Post: Florian |
|
| Master Game Servers Services | SethWillits | 6 | 5,540 |
Jul 18, 2006 04:28 PM Last Post: SethWillits |
|
| Ways to Network. | BinarySpike | 28 | 11,743 |
May 10, 2005 07:44 PM Last Post: kodex |
|
| Network Code Design | Bachus | 5 | 4,230 |
Sep 26, 2004 06:54 PM Last Post: arcnon |
|

