ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_NetSession

Net session class.
Contained in: global
Derived from: none
Derived by: none
Group: Network (NetSessions)

#include <ClanLib/network.h>


public function member index:

Construction:

CL_NetSession(const std::string& app_id);
CL_NetSession(const CL_NetSession& copy);
virtual ~CL_NetSession();

Attributes:

CL_NetGroup& get_all();

Operations:

void start_listen(const std::string& listen_port);
void stop_listen();
CL_NetComputer connect(const CL_IPAddress& address);
CL_NetComputer connect_async(const std::string& hostname, const std::string& port);
void show_debug(bool enable = true);

Signals:

CL_Signal_v1<CL_NetComputer& >& sig_computer_connected();
CL_Signal_v1<CL_NetComputer& >& sig_computer_reconnected();
CL_Signal_v1<CL_NetComputer& >& sig_computer_disconnected();
CL_Signal_v1<CL_NetStream& >& sig_netstream_connect(const std::string& netstream);
CL_Signal_v2<CL_NetPacket& , CL_NetComputer& >& sig_netpacket_receive(const std::string& packet_channel);

Implementation:

CL_NetSession(CL_NetSession_Generic* impl);
 

Description:


Function Member Descriptions:

CL_NetSession::CL_NetSession - Constructs a netsession.
CL_NetSession(const std::string& app_id);


CL_NetSession::connect - Connect to remote netsession.
CL_NetComputer connect(const CL_IPAddress& address);


CL_NetSession::connect_async - Connect to remote netsession asyncronously.
CL_NetComputer connect_async(const std::string& hostname, const std::string& port);
<p>The DNS lookup and connect is done in a worker thread, thus not
blocking the calling thread. If the connection fails,
CL_NetSession::sig_disconnected() is emitted.</p>



CL_NetSession::get_all - Returns a list of all computers connected.
CL_NetGroup& get_all();


CL_NetSession::show_debug - Enable or disable debug output.
void show_debug(bool enable = true);
<p>This will output the netchannels each netpacket arrive in.</p>



CL_NetSession::sig_computer_connected - Signal invoked when a computer connects to the netsession server.
CL_Signal_v1<CL_NetComputer& >& sig_computer_connected();


CL_NetSession::sig_computer_disconnected - Signal invoked when a computer disconnects from the netsession server.
CL_Signal_v1<CL_NetComputer& >& sig_computer_disconnected();


CL_NetSession::sig_computer_reconnected - Signal invoked when a computer re-connects to the netsession server.
CL_Signal_v1<CL_NetComputer& >& sig_computer_reconnected();
<p>This happens when a CL_NetComputer instance has still not been destroyed
since its last connect (allows you to recognize players dropping out, so
they dont loose their score when they reconnect).</p>



CL_NetSession::sig_netpacket_receive - Signal invoked when someone sends a netpacket to the specified packet channel.
CL_Signal_v2<CL_NetPacket& , CL_NetComputer& >& sig_netpacket_receive(const std::string& packet_channel);


CL_NetSession::sig_netstream_connect - Signal invoked when someone makes a connection to the specified
netstream.
CL_Signal_v1<CL_NetStream& >& sig_netstream_connect(const std::string& netstream);


CL_NetSession::start_listen - Start listening for connections.
void start_listen(const std::string& listen_port);


CL_NetSession::stop_listen - Stop listening for connections and disconnect everyone.
void stop_listen();



Variable Member Descriptions: