#ifndef SOCKETIO_HPP #define SOCKETIO_HPP #include <string> #include <cstring> #include <vector> #include <iostream> #include <exception> #include <cmath> #include <stdexcept> #include <sys/socket.h> #include <netinet/in.h> class cppsocket{ private: struct sockaddr_in serv_addr; int sock; std::vector<char> buffer; public: const static std::size_t buffersize = 256; cppsocket(sockaddr_in _serv_addr, int _sock); cppsocket(); cppsocket(const std::string& addr, unsigned int PORT); void close(); int socket_id(); void write(const std::string& message); void write(const std::vector<char>& message); std::vector<char> receive(); }; class server_socket{ private: int port_; int server_fd; struct sockaddr_in address; socklen_t addrlen; public: int port(); server_socket(int _port); cppsocket accept_connection(); }; #endif