#include <SocketClient.hpp>
Public Member Functions | |
void | connectToServer (std::string Host, int Port) |
Connect to a server. | |
bool | isClientConnected () |
Are we connected to the server. | |
virtual void | onSocketClientConnect (Socket const &socket) |
Event triggered on a socket connection. | |
virtual void | onSocketClientDisconnect (Socket const &socket) |
Event triggered on a socket read. | |
virtual void | onSocketClientMessage (Socket const &socket, std::string const &Message) |
Event triggered on a socket message. | |
virtual void | onSocketClientRead (Socket const &socket, DynamicBuffer< char > &ReadBuffer) |
Event triggered on a socket read. | |
void | sendToServer (std::string const &Message) |
Send a message to the server. | |
SocketClient () | |
Default Constructor. | |
virtual | ~SocketClient () |
Destructor. |
This is an interface for classes wishing to receive socket events
Definition at line 60 of file SocketClient.hpp.
void SocketClient::connectToServer | ( | std::string | Host, | |
int | Port | |||
) |
Connect to a server.
Host | Hostname of the server to connect to | |
Port | Port of the server to connect to |
Definition at line 67 of file SocketClient.cpp.
References H::Socket::connect(), H::Socket::createSocket(), H::SOCKET_INTERNET, and H::SOCKET_STREAM.
Referenced by GizmodLibVisualPlugin::init().
bool SocketClient::isClientConnected | ( | ) |
Are we connected to the server.
Are we connected to the server?
Definition at line 76 of file SocketClient.cpp.
Referenced by Gizmod::GizmoClient::sendEventATIX10(), Gizmod::GizmoClient::sendEventCPUUsage(), Gizmod::GizmoClient::sendEventLIRC(), Gizmod::GizmoClient::sendEventPowermate(), Gizmod::GizmoClient::sendEventSoundCard(), Gizmod::GizmoClient::sendEventSoundVisualization(), Gizmod::GizmoClient::sendEventStandard(), and Gizmod::GizmoClient::sendEventWindowFocus().
void SocketClient::onSocketClientConnect | ( | Socket const & | socket | ) | [virtual] |
Event triggered on a socket connection.
Event triggered on socket connect.
socket | The socket |
Definition at line 84 of file SocketClient.cpp.
References cdbg.
void SocketClient::onSocketClientDisconnect | ( | Socket const & | socket | ) | [virtual] |
Event triggered on a socket read.
Event triggered on socket disconnect.
socket | The socket |
Definition at line 93 of file SocketClient.cpp.
References cdbg.
void SocketClient::onSocketClientMessage | ( | Socket const & | socket, | |
std::string const & | Message | |||
) | [virtual] |
Event triggered on a socket message.
Event triggered on a socket client message.
socket | The Socket that triggered the event | |
Message | The message |
Definition at line 103 of file SocketClient.cpp.
References cdbg.
void SocketClient::onSocketClientRead | ( | Socket const & | socket, | |
DynamicBuffer< char > & | ReadBuffer | |||
) | [virtual] |
Event triggered on a socket read.
Event triggered on socket read.
socket | The socket | |
ReadBuffer | The data |
Definition at line 113 of file SocketClient.cpp.
References cdbg, and H::DynamicBuffer< DataType >::length().
void SocketClient::sendToServer | ( | std::string const & | Message | ) |
Send a message to the server.
Send a formatted message to the server.
Message | The message to send |
Definition at line 167 of file SocketClient.cpp.
References H::Socket::writeMessage().
Referenced by Gizmod::GizmoClient::sendEventATIX10(), Gizmod::GizmoClient::sendEventCPUUsage(), Gizmod::GizmoClient::sendEventLIRC(), Gizmod::GizmoClient::sendEventPowermate(), Gizmod::GizmoClient::sendEventSoundCard(), Gizmod::GizmoClient::sendEventSoundVisualization(), Gizmod::GizmoClient::sendEventStandard(), and Gizmod::GizmoClient::sendEventWindowFocus().