starting to add new Socket interface

This commit is contained in:
Erik Frojdh
2019-01-23 11:47:13 +01:00
parent 3eca4c0535
commit 99a1c609f1
10 changed files with 212 additions and 21 deletions

View File

@ -0,0 +1,25 @@
#pragma once
#include "DataSocket.h"
#include <cstdint>
#include <netdb.h>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
namespace sls {
class ServerSocket : public DataSocket {
public:
ServerSocket(int port);
DataSocket accept();
const std::string &getLastClient() { return lastClient_; }
private:
std::string lastClient_ = std::string(INET_ADDRSTRLEN, '\0');
std::string thisClient_ = std::string(INET_ADDRSTRLEN, '\0');
// char lastClient_[INET_ADDRSTRLEN]{};
};
}; //namespace sls