NLNET::CLoginClient Class Reference

#include <login_client.h>


Detailed Description

Author:
Vianney Lecroart

Nevrax France

Date:
2002

Definition at line 51 of file login_client.h.

Static Public Member Functions

std::string connectToShard (const std::string &addr, CUdpSimSock &cnx)
std::string connectToShard (const std::string &addr, CUdpSock &cnx)
std::string connectToShard (CLoginCookie &lc, const std::string &addr, CCallbackClient &cnx)


Member Function Documentation

string NLNET::CLoginClient::connectToShard const std::string &  addr,
CUdpSimSock cnx
[static]
 

Try to connect to the shard and return an UDP simulate connection to the shard.

Definition at line 125 of file login_client.cpp.

References addr, NLNET::CUdpSimSock::connect(), NLNET::CUdpSimSock::connected(), nlassert, and NLNET::ShardValidateReason.

00126 {
00127         nlassert (!cnx.connected());
00128         
00129         try
00130         {
00131                 //
00132                 // S12: connect to the FES. Note: In UDP mode, it's the user that have to send the cookie to the front end
00133                 //
00134                 // See firewall comment in connectToShard(string,CUdpSock)
00135                 //
00136                 cnx.connect (CInetAddress(addr));
00137         }
00138         catch (ESocket &e)
00139         {
00140                 return string("FES refused the connection (") + e.what () + ")";
00141         }
00142 
00143         return ShardValidateReason;
00144 }

string NLNET::CLoginClient::connectToShard const std::string &  addr,
CUdpSock cnx
[static]
 

Try to connect to the shard and return an UDP connection to the shard.

Definition at line 101 of file login_client.cpp.

References addr, NLNET::CSock::connect(), NLNET::CSock::connected(), nlassert, and NLNET::ShardValidateReason.

00102 {
00103         nlassert (!cnx.connected());
00104         
00105         try
00106         {
00107                 //
00108                 // S12: connect to the FES. Note: In UDP mode, it's the user that have to send the cookie to the front end
00109                 //
00110                 // If a personal firewall such as ZoneAlarm is installed and permission not granted yet,
00111                 // the connect blocks until the user makes a choice.
00112                 // If the user denies the connection, the exception ESocket is thrown.
00113                 // Other firewalls such as Kerio make the send() fail instead.
00114                 //
00115                 cnx.connect (CInetAddress(addr));
00116         }
00117         catch (ESocket &e)
00118         {
00119                 return string("FES refused the connection (") + e.what () + ")";
00120         }
00121 
00122         return ShardValidateReason;
00123 }

string NLNET::CLoginClient::connectToShard CLoginCookie lc,
const std::string &  addr,
CCallbackClient cnx
[static]
 

Try to connect to the shard and return a TCP connection to the shard.

Definition at line 63 of file login_client.cpp.

References NLNET::CCallbackNetBase::addCallbackArray(), addr, NLNET::CCallbackClient::connect(), NLNET::CCallbackClient::connected(), NLNET::CCallbackNetBase::displayAllMyAssociations(), NLNET::FESCallbackArray, NLNET::CCallbackNetBase::getSIDA(), nlassert, NLMISC::nlSleep(), NLNET::CCallbackClient::send(), NLMISC::CMemStream::serial(), NLNET::ShardValidate, NLNET::ShardValidateReason, and NLNET::CCallbackClient::update().

00064 {
00065         nlassert (!cnx.connected());
00066         
00067         try
00068         {
00069                 //
00070                 // S12: connect to the FES and send "SV" message to the FES
00071                 //
00072                 cnx.connect (CInetAddress(addr));
00073                 cnx.addCallbackArray (FESCallbackArray, sizeof(FESCallbackArray)/sizeof(FESCallbackArray[0]));
00074 
00075                 cnx.displayAllMyAssociations ();
00076 
00077                 // send the cookie
00078                 CMessage msgout2 (cnx.getSIDA (), "SV");
00079                 msgout2.serial (lc);
00080                 cnx.send (msgout2);
00081 
00082                 // wait the answer of the connection
00083                 ShardValidate = false;
00084                 while (cnx.connected() && !ShardValidate)
00085                 {
00086                         cnx.update ();
00087                         nlSleep(10);
00088                 }
00089                 
00090                 // have we received the answer?
00091                 if (!ShardValidate) return "FES disconnect me";
00092         }
00093         catch (ESocket &e)
00094         {
00095                 return string("FES refused the connection (") + e.what () + ")";
00096         }
00097 
00098         return ShardValidateReason;
00099 }


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:58:22 2004 for NeL by doxygen 1.3.6