Next: 2.3 ClientProxy
Up: 2. Class Reference
Previous: 2.1 PlayerClient
Contents
Subsections
The PlayerMultiClient makes it easy to control multiple Player connections within one thread. You can connect to any number of Player servers and read from all of them with a single Read().
PlayerMultiClient()
Uninteresting constructor.
int GetNumClients(void)
How many clients are currently being managed?
PlayerClient* GetClient( char* host, int port )
Return a pointer to the client associated with the given host and port, or NULL if none is connected to that address.
PlayerClient* GetClient( struct in_addr* addr, int port )
Return a pointer to the client associated with the given binary host and port, or NULL if none is connected to that address.
void AddClient(PlayerClient* client)
After creating and connecting a PlayerClient object, you should use this method to hand it over to the PlayerMultiClient for management.
void RemoveClient(PlayerClient* client)
Remove a client from PlayerMultiClient management.
int Read()
Read on one of the client connections. This method will return after reading from the server with first available data. It will not read data from all servers. You can use the fresh flag in each client object to determine who got new data. You should then set that flag to false. Returns 0 if everything went OK, -1 if something went wrong.
int ReadLatest( int max_reads )
Same as Read(), but reads everything off the socket so we end up with the freshest data, subject to N maximum reads.
Next: 2.3 ClientProxy
Up: 2. Class Reference
Previous: 2.1 PlayerClient
Contents
2004-05-31