TCP/IP network system class. More...
#include <spNetworkSystemTCP.hpp>
Public Member Functions | |
NetworkSystemTCP () | |
~NetworkSystemTCP () | |
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) |
TCP/IP network system class.
sp::network::NetworkSystemTCP::NetworkSystemTCP | ( | ) |
sp::network::NetworkSystemTCP::~NetworkSystemTCP | ( | ) |
void sp::network::NetworkSystemTCP::disconnect | ( | ) | [virtual] |
Disconnects from the current network server and closes the network session.
Implements sp::network::NetworkSystem.
io::stringc sp::network::NetworkSystemTCP::getDescription | ( | ) | const [virtual] |
Returns a description string for the network system.
Implements sp::network::NetworkSystem.
NetworkMember* sp::network::NetworkSystemTCP::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::NetworkSystemTCP::hostServer | ( | u16 | Port = DEFAULT_PORT |
) | [virtual] |
Hosts a new network server.
Implements sp::network::NetworkSystem.
NetworkServer* sp::network::NetworkSystemTCP::joinServer | ( | const io::stringc & | IPAddress, | |
u16 | Port = DEFAULT_PORT | |||
) | [virtual] |
Joins the network server.
Implements sp::network::NetworkSystem.
bool sp::network::NetworkSystemTCP::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::NetworkSystemTCP::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::NetworkSystemTCP::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::NetworkSystemTCP::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.