Socket Server
|
#include <socket_listener.h>
Classes | |
class | MessageHandler |
Public Member Functions | |
SocketListener (std::string ipAddress, int port) | |
~SocketListener () | |
virtual void | sendMessage (int client_socket_fd, std::shared_ptr< char[]> buffer) override |
MessageHandler | createMessageHandler (std::function< void()> cb) |
bool | init () |
void | run () |
void | cleanup () |
SocketListener::SocketListener | ( | std::string | ip_address, |
int | port | ||
) |
Constructor Initialize with ip_address, port and message_handler
SocketListener::~SocketListener | ( | ) |
Destructor TODO: Determine if we should make buffer a class member
void SocketListener::cleanup | ( | ) |
Perform any cleanup work
cleanUp @method TODO: Determine if we should be cleaning up buffer memory
SocketListener::MessageHandler SocketListener::createMessageHandler | ( | std::function< void()> | cb | ) |
bool SocketListener::init | ( | ) |
Perform intialization work
init TODO: Initialize buffer memory, if buffer is to be a class member
void SocketListener::run | ( | ) |
Main message loop
run @method Main message loop TODO: Implement multithreading
|
overridevirtual |
Send a message to a client socket described by its file descriptor
[in] | {int} | client_socket_fd The client socket file descriptor |
[in] | {std::string} | The message to be sent |
sendMessage @method Send a null-terminated array of characters, supplied as a const char pointer, to a client socket described by its file descriptor
Implements SendInterface.