Public Member Functions

sp::network::NetworkSessionLogin Class Reference
[Network System]

#include <spNetworkSessionLogin.hpp>

Inheritance diagram for sp::network::NetworkSessionLogin:
sp::network::NetworkBaseUDP sp::network::NetworkBase

List of all members.

Public Member Functions

 NetworkSessionLogin ()
 ~NetworkSessionLogin ()
bool request (const NetworkAddress &Address)
bool request (u16 Port, const std::list< io::stringc > &IPAddressList)
 Sends a session request to all specified IP addresses with the given port number.
bool receiveAnswer ()
void setSessionKey (const io::stringc &Key)
 Sets the new session key.
io::stringc getSessionKey () const
void setSessionAnswerCallback (const SessionAnswerCallback &Callback_)

Detailed Description

The network session login is used to request open games sessions over the network. This should be done by the clients only.

// Session request answer callback.
void SessionAnswerProc(const network::NetworkAddress &ServerAddress, const io::stringc &SessionDescription)
{
    // Store server address here ...
}

// ...

network::NetworkSessionLogin Login;

// The session key is used that only instances of your game can make requests to other instances of the same game.
Login.setSessionKey(SessionKey);
Login.setSessionAnswerCallback(SessionAnswerProc);

// Send a session request to all available broadcast IP addresses.
Login.request(SessionPort, NetSys->getBroadcastIPList());

// Wait a moment for answers
while (WaitingForAnswers)
{
    // When a request answer message has been received, your answer callback function will be called.
    Login.receiveAnswers();
    
    // Maybe do some render stuff here ...
}
See also:
NetworkSessionReception

Constructor & Destructor Documentation

sp::network::NetworkSessionLogin::NetworkSessionLogin (  ) 
sp::network::NetworkSessionLogin::~NetworkSessionLogin (  ) 

Member Function Documentation

io::stringc sp::network::NetworkSessionLogin::getSessionKey (  )  const [inline]
bool sp::network::NetworkSessionLogin::receiveAnswer (  ) 

Receives the next incomming session request answer. If an answer has been received the session answer callback will be called.

Returns:
True if an answer has been received.
See also:
setSessionAnswerCallback
bool sp::network::NetworkSessionLogin::request ( u16  Port,
const std::list< io::stringc > &  IPAddressList 
)

Sends a session request to all specified IP addresses with the given port number.

bool sp::network::NetworkSessionLogin::request ( const NetworkAddress Address  ) 

Sends a session request to the specified address.

Parameters:
Address,: Specifies the address to which the request is to be send.
SessionKey,: Specifies the session key string. This string must be equal to the sesssion reception's key string (which holds the server).
Returns:
True if the request succeeded.
void sp::network::NetworkSessionLogin::setSessionAnswerCallback ( const SessionAnswerCallback Callback_  )  [inline]
void sp::network::NetworkSessionLogin::setSessionKey ( const io::stringc Key  )  [inline]

Sets the new session key.


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