49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#ifndef __UDPServerSocket_h__
|
|
#define __UDPServerSocket_h__
|
|
|
|
#include "Socket.h"
|
|
#include "UDPSocket.h"
|
|
#include "Command.h"
|
|
|
|
namespace core {
|
|
|
|
///
|
|
/// UDPSocket
|
|
///
|
|
/// Manage a socket connection as a UDP server type. Connections to the socket are processed through
|
|
/// the session list functionality. A list of sessions is maintained in a vector object.
|
|
///
|
|
|
|
class UDPServerSocket : public UDPSocket, public Command {
|
|
|
|
public:
|
|
|
|
UDPServerSocket(EPoll &ePoll, std::string url, short int port, std::string commandName);
|
|
~UDPServerSocket();
|
|
|
|
protected:
|
|
|
|
//---------------------------------------------------------------
|
|
// Override the virtual dataReceived since for the server these
|
|
// are requests to accept the new connection socket.
|
|
//---------------------------------------------------------------
|
|
|
|
void onDataReceived(std::string data) override;
|
|
|
|
int processCommand(Session *session);
|
|
|
|
//------------------------------------------------------------------------------------
|
|
// The retrieved socket connections are placed into the client vector list.
|
|
//------------------------------------------------------------------------------------
|
|
|
|
std::vector<Session *> sessions;
|
|
|
|
private:
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|