Public Member Functions

sp::network::NetworkSystemUDP Class Reference

UDP/IP network system class. More...

#include <spNetworkSystemUDP.hpp>

Inheritance diagram for sp::network::NetworkSystemUDP:
sp::network::NetworkBaseUDP sp::network::NetworkSystem sp::network::NetworkBase

List of all members.

Public Member Functions

 NetworkSystemUDP ()
 ~NetworkSystemUDP ()
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

UDP/IP network system class.


Constructor & Destructor Documentation

sp::network::NetworkSystemUDP::NetworkSystemUDP (  ) 
sp::network::NetworkSystemUDP::~NetworkSystemUDP (  ) 

Member Function Documentation

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.

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::NetworkSystemUDP::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::NetworkSystemUDP::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::NetworkSystemUDP::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