[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The game Kamikaze, which provides support for GGZ, uses an own set of network classes which are very convenient to use. Their development was backed by experiences with the other toolkits. Net objects provide simple buffered input/output with host/network conversion equal to easysock. MNet objects are inherited and in addition provide multicasting. A sample networking session looks like this:
@verbatim // The network object MNet n;
// Send unbuffered and buffered message to player 1 n << Net::channel << fd1; n << "hello world"; n << Net::begin << arg1 << arg2 << Net::end << Net::flush;
// Setup broadcasting n << MNet::add << fd1; n << MNet::add << fd2;
// Broadcast message to both players n << Mnet::multicast; n << "hello all";
// Reset to normal behaviour n << MNet::peer;