Public Member Functions

sp::network::NetworkSystemTCP Class Reference

TCP/IP network system class. More...

#include <spNetworkSystemTCP.hpp>

Inheritance diagram for sp::network::NetworkSystemTCP:
sp::network::NetworkBase sp::network::NetworkSystem

List of all members.

Public Member Functions

 NetworkSystemTCP ()
 ~NetworkSystemTCP ()
io::stringc getDescription () const
 Returns a description string for the network system.
NetworkServerhostServer (u16 Port=DEFAULT_PORT)
 Hosts a new network server.
NetworkServerjoinServer (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)
NetworkMembergetMemberByAddress (const NetworkAddress &Address)

Detailed Description

TCP/IP network system class.


Constructor & Destructor Documentation

sp::network::NetworkSystemTCP::NetworkSystemTCP (  ) 
sp::network::NetworkSystemTCP::~NetworkSystemTCP (  ) 

Member Function Documentation

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.

Parameters:
Client,: Specifies where the client pointer is to be stored.
Returns:
True if a new client has joined the server.
        // 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.

Parameters:
Client,: Specifies where the client pointer is to be stored.
Returns:
True if a client has left the server.
        // Example:
        NetworkClient* LeftClient;
        while (spNetwork->popClientLeaveStack(LeftClient))
            RemoveOldClientFromGame(LeftClient);
Note:
Here you only have to use the pointer for comparision but no longer use the object, because it has already been deleted!

Implements sp::network::NetworkSystem.

bool sp::network::NetworkSystemTCP::receivePacket ( NetworkPacket Packet,
NetworkMember *&  Sender 
) [virtual]

Receives a network packet and returns the sender.

Parameters:
Packet,: Returns a new incomming message.
Sender,: Returns the sender.
Returns:
True if a new network packet has been received.

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.

Parameters:
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.
Returns:
True if the function succeeded.

Implements sp::network::NetworkSystem.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines