UDP/IP network system class. More...
#include <spNetworkSystemUDP.hpp>
Public Member Functions | |
NetworkSystemUDP () | |
~NetworkSystemUDP () | |
io::stringc | getDescription () const |
Returns a description string for the network system. | |
NetworkServer * | hostServer (u16 Port=DEFAULT_PORT) |
Hosts a new network server. | |
NetworkServer * | joinServer (const io::stringc &IPAddress, u16 Port=DEFAULT_PORT) |
Joins the network server. | |
void | disconnect () |
Disconnects from the current network server and closes the network session. | |
bool | sendPacket (const NetworkPacket &Packet, NetworkMember *Receiver=0) |
bool | receivePacket (NetworkPacket &Packet, NetworkMember *&Sender) |
bool | popClientJoinStack (NetworkClient *&Client) |
bool | popClientLeaveStack (NetworkClient *&Client) |
NetworkMember * | getMemberByAddress (const NetworkAddress &Address) |
UDP/IP network system class.
sp::network::NetworkSystemUDP::NetworkSystemUDP | ( | ) |
sp::network::NetworkSystemUDP::~NetworkSystemUDP | ( | ) |
void sp::network::NetworkSystemUDP::disconnect | ( | ) | [virtual] |
Disconnects from the current network server and closes the network session.
Implements sp::network::NetworkSystem.
io::stringc sp::network::NetworkSystemUDP::getDescription | ( | ) | const [virtual] |
Returns a description string for the network system.
Implements sp::network::NetworkSystem.
NetworkMember* sp::network::NetworkSystemUDP::getMemberByAddress | ( | const NetworkAddress & | Address | ) | [virtual] |
Returns a pointer to the network member with the given address or 0 (null) if there is no member with this address.
Implements sp::network::NetworkSystem.
NetworkServer* sp::network::NetworkSystemUDP::hostServer | ( | u16 | Port = DEFAULT_PORT |
) | [virtual] |
Hosts a new network server.
Implements sp::network::NetworkSystem.
NetworkServer* sp::network::NetworkSystemUDP::joinServer | ( | const io::stringc & | IPAddress, | |
u16 | Port = DEFAULT_PORT | |||
) | [virtual] |
Joins the network server.
Implements sp::network::NetworkSystem.
bool sp::network::NetworkSystemUDP::popClientJoinStack | ( | NetworkClient *& | Client | ) | [virtual] |
Pops a client from the join-stack. Use this to determine when a new client joined the server.
Client,: | Specifies where the client pointer is to be stored. |
// Example: NetworkClient* NewClient; while (spNetwork->popClientJoinStack(NewClient)) AddNewClientToGame(NewClient);
Implements sp::network::NetworkSystem.
bool sp::network::NetworkSystemUDP::popClientLeaveStack | ( | NetworkClient *& | Client | ) | [virtual] |
Pops a client from the leave-stack. Use this to determine when a client left the server.
Client,: | Specifies where the client pointer is to be stored. |
// Example: NetworkClient* LeftClient; while (spNetwork->popClientLeaveStack(LeftClient)) RemoveOldClientFromGame(LeftClient);
Implements sp::network::NetworkSystem.
bool sp::network::NetworkSystemUDP::receivePacket | ( | NetworkPacket & | Packet, | |
NetworkMember *& | Sender | |||
) | [virtual] |
Receives a network packet and returns the sender.
Packet,: | Returns a new incomming message. | |
Sender,: | Returns the sender. |
Implements sp::network::NetworkSystem.
bool sp::network::NetworkSystemUDP::sendPacket | ( | const NetworkPacket & | Packet, | |
NetworkMember * | Receiver = 0 | |||
) | [virtual] |
Sends a network packet to the given network member.
Packet,: | Specifies the network packet which is to be send. | |
Receiver,: | Specifies the network member which is to receive the packet. By default 0 which means that each member gets the packet. |
Implements sp::network::NetworkSystem.