#include <clientconnector.h>
Public Methods | |
void | handleException (GeneralException &e) |
Not currently used. More... | |
void | sendPacket (PacketBuffer *pPkt) |
Sends the packet. More... | |
void | sendPacket (PacketBuffer &pPkt) |
Sends the packet. More... | |
PacketBuffer * | recvPacket () |
Receives a packet. More... | |
void | operator<< (PacketBuffer &) |
Sends the packet. More... | |
void | operator<< (PacketBuffer *) |
Sends the packet. More... | |
void | operator>> (PacketBuffer &) |
Receives a packet. More... | |
ClientConnector () | |
ClientConnector (const char *pszHost, word wPort) | |
Constructs and connects to host. More... | |
~ClientConnector () | |
Destroys and closes any connections. More... | |
CONSTCHAR * | getServer () |
Returns the server host name you assigned this client object. More... | |
word | getPort () |
Returns the port you assigned this client object. More... | |
bool | isConnected () |
Returns if this client is connected or not. More... | |
BufferedSocket * | getSocket () |
void | reconnect () |
Tries to reconnect to the server. More... | |
void | connect () |
Connects to the server. More... | |
void | connect (const char *szHost, const unsigned wPort) |
Stores server info passed in, and attempts to connect to the server. More... | |
void | close () |
Closes the connection to the server. More... | |
Protected Methods | |
void | cleanup () |
Closes the connection without throwing any exeptions on errors during socket closer. Deletes the socket. More... | |
Protected Attributes | |
unsigned16 | m_wPort |
Port number of the server you wish to connect to. More... | |
CStr | m_strHost |
Host name of the server you wish to connect to. More... | |
BufferedSocket * | m_pSocket |
Socket connected to the server. More... |
Use this class when you want to connect to a server that uses ssobjects. ClientConnector provides methods and operators for sending a receiving packets to/from the server you are connected to.
|
Default constructor. [Windows only] If ClientConnector hasn't yet called WSAStartup, it will be called now.
|
|
Constructs and connects to host. Constructs a ClientConnector object and connects to the host. [Win32] If the WSAStartup hasn't been called, it will be called at this point. Upon destruction, WSACleanup will be called.
|
|
Destroys and closes any connections. Closes connection. [Win32] Also calls WSACleanup.
|
|
Closes the connection without throwing any exeptions on errors during socket closer. Deletes the socket. Closes the socket and deletes the memory accociated with the socket. It will not throw any exceptions on error. Use this when you are in a catch block, and need to close the connection. |
|
Closes the connection to the server. Closes the connection and deletes the memory accociated with the socket.
|
|
Stores server info passed in, and attempts to connect to the server.
|
|
Connects to the server. Attempts to connect to the server. [Win32] If ClientConnector hasn't yet called WSAStartup, it will be called now.
|
|
Returns the port you assigned this client object.
|
|
Returns the server host name you assigned this client object.
|
|
|
|
Not currently used.
|
|
Returns if this client is connected or not.
|
|
Sends the packet. Send the data pointed to by ppacket.
|
|
Sends the packet. Send the data referenced by packet.
|
|
Receives a packet. Reads a full packet from the socket.
|
|
Tries to reconnect to the server. Closes down any existing connection, and tries to connect to the server by calling connect() method.
|
|
Receives a packet. Reads a full packet from the socket.
|
|
Sends the packet.
|
|
Sends the packet.
|
|
Socket connected to the server.
|
|
Host name of the server you wish to connect to.
|
|
Port number of the server you wish to connect to.
|