Socket Server
Classes | Public Member Functions | List of all members
SocketListener Class Reference

#include <socket_listener.h>

Inheritance diagram for SocketListener:
SendInterface

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 ()
 

Constructor & Destructor Documentation

◆ SocketListener()

SocketListener::SocketListener ( std::string  ip_address,
int  port 
)

Constructor Initialize with ip_address, port and message_handler

◆ ~SocketListener()

SocketListener::~SocketListener ( )

Destructor TODO: Determine if we should make buffer a class member

Member Function Documentation

◆ cleanup()

void SocketListener::cleanup ( )

Perform any cleanup work

cleanUp @method TODO: Determine if we should be cleaning up buffer memory

◆ createMessageHandler()

SocketListener::MessageHandler SocketListener::createMessageHandler ( std::function< void()>  cb)

◆ init()

bool SocketListener::init ( )

Perform intialization work

init TODO: Initialize buffer memory, if buffer is to be a class member

◆ run()

void SocketListener::run ( )

Main message loop

run @method Main message loop TODO: Implement multithreading

◆ sendMessage()

void SocketListener::sendMessage ( int  client_socket_fd,
std::shared_ptr< char[]>  s_ptr 
)
overridevirtual

Send a message to a client socket described by its file descriptor

Parameters
[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.


The documentation for this class was generated from the following files: