diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d35b75d Binary files /dev/null and b/.DS_Store differ diff --git a/haryu/.DS_Store b/haryu/.DS_Store index fc872a0..3da7d89 100644 Binary files a/haryu/.DS_Store and b/haryu/.DS_Store differ diff --git a/haryu/study/.DS_Store b/haryu/study/.DS_Store index 71e15e4..58a4ff1 100644 Binary files a/haryu/study/.DS_Store and b/haryu/study/.DS_Store differ diff --git a/haryu/study/kserver/.DS_Store b/haryu/study/kserver/.DS_Store index 783a6fb..3c3a010 100644 Binary files a/haryu/study/kserver/.DS_Store and b/haryu/study/kserver/.DS_Store differ diff --git a/haryu/study/kserver/httpmsg b/haryu/study/kserver/httpmsg index 4c6dbc5..318846d 100644 --- a/haryu/study/kserver/httpmsg +++ b/haryu/study/kserver/httpmsg @@ -1,3 +1,4 @@ HTTP/1.1 200 OK Content-type: text/html -Content-length: 4097 +Connection: keep-alive +Content-length: 3059 diff --git a/haryu/study/kserver/index.html b/haryu/study/kserver/index.html index b981701..7dc0745 100644 --- a/haryu/study/kserver/index.html +++ b/haryu/study/kserver/index.html @@ -1,101 +1,74 @@ - + - - Practice_#3rd_weeks + + Haryu's ShowCase + + + - -
- -
-
- -
- + - \ No newline at end of file + \ No newline at end of file diff --git a/haryu/study/kserver/index_comp.html b/haryu/study/kserver/index_comp.html deleted file mode 100644 index 7dc0745..0000000 --- a/haryu/study/kserver/index_comp.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - Haryu's ShowCase - - - - - -
-
-
-
-
- -

Hansol Ryu

-

Junior Programmer
Growth hacker..

-

# Tags

- -
-
- -

Hello WEB world!

- -
- Home / Hello WEB world! -
-

Hello WEB world!

-

2022 - 08 - 18

- -
- - -
-
-
- - \ No newline at end of file diff --git a/haryu/study/kserver/index_test_1.html b/haryu/study/kserver/index_test_1.html new file mode 100644 index 0000000..b981701 --- /dev/null +++ b/haryu/study/kserver/index_test_1.html @@ -0,0 +1,101 @@ + + + + + + + + + Practice_#3rd_weeks + + +
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/haryu/study/kserver/k_class_page.cpp b/haryu/study/kserver/k_class_page.cpp index 3b413ba..edabca8 100644 --- a/haryu/study/kserver/k_class_page.cpp +++ b/haryu/study/kserver/k_class_page.cpp @@ -1,236 +1,338 @@ #include "k_class_page.hpp" // 목표 1 : 페이지 전달 서버 구축하기 -// 목표 2 : 다중 포트 상태로 값이 들어오면 서버 클래스가 자동으로 멀티 포트로 운영됨 -// 목표 3 : 접근하면 index.html 전달하기 -// 목표 4 : index_comp.html 전닳시키고 커낵션 종료 시켜보기 +// 목표 2 : 다중 포트 상태로 값이 들어오면 서버 클래스가 자동으로 멀티 포트로 +// 운영됨 목표 3 : 접근하면 index.html 전달하기 목표 4 : index_comp.html +// 전닳시키고 커낵션 종료 시켜보기 void Server::exitWithPerror(const String& msg_) { - CER << msg_ << CEND; - exit(EXIT_FAILURE); + CER << msg_ << CEND; + exit(EXIT_FAILURE); } -void Server::changeEvents(VEC& changeList_, uintptr_t ident, int16_t filter, uint16_t flags, uint16_t fflags, intptr_t data, void* udata) { - struct kevent tempEvent; +void Server::changeEvents(VEC& changeList_, uintptr_t ident, + int16_t filter, uint16_t flags, uint16_t fflags, + intptr_t data, void* udata) { + struct kevent tempEvent; - EV_SET(&tempEvent, ident, filter, flags, fflags, data, udata); - changeList_.push_back(tempEvent); + EV_SET(&tempEvent, ident, filter, flags, fflags, data, udata); + changeList_.push_back(tempEvent); } -void Server::disconnectClients_(int clientFd, MAP& clients_) { - std::cout << "client disconnected : " << clientFd << std::endl; - close(clientFd); - clients_.erase(clientFd); +void Server::disconnectClients(int clientFd, MAP& clients_) { + std::cout << "client disconnected : " << clientFd << std::endl; + close(clientFd); + clients_.erase(clientFd); } -Server::Server(int portNumber_, char **port_) : msg_("") { - if (portNumber_ == 1) { - COUT << "./k_http_server {port 1} {port 2} ... " << CEND; - exit (1); - } - serverSocket_ = new int[portNumber_]; - if(serverSocket_ == nullptr) { - CER << "constructor error" << CEND; - exit (1); - } - serverAddr_ = new sockaddr_in[portNumber_]; - if (serverAddr_ == nullptr) { - CER << "constructor error" << CEND; - exit (1); - } - for (int i = 0; i + 1 < portNumber_; i++) { - serverSocket_[i] = socket(PF_INET, SOCK_STREAM, 0); - if (serverSocket_[i] == -1) { exitWithPerror("socket() error\n" + String(strerror(errno))); } - - memset(&serverAddr_[i], 0, sizeof(serverAddr_[i])); - serverAddr_[i].sin_family = AF_INET; - serverAddr_[i].sin_addr.s_addr = htonl(INADDR_ANY); - serverAddr_[i].sin_port = htons(atoi(port_[i + 1])); - } - portnum_ = portNumber_ - 1; +Server::Server(int portNumber_, char** port_) : msg_("") { + if (portNumber_ == 1) { + COUT << "./k_http_server {port 1} {port 2} ... " << CEND; + exit(1); + } + serverSocket_ = new int[portNumber_]; + if (serverSocket_ == nullptr) { + CER << "constructor error" << CEND; + exit(1); + } + serverAddr_ = new sockaddr_in[portNumber_]; + if (serverAddr_ == nullptr) { + CER << "constructor error" << CEND; + exit(1); + } + for (int i = 0; i + 1 < portNumber_; i++) { + serverSocket_[i] = socket(PF_INET, SOCK_STREAM, 0); + if (serverSocket_[i] == -1) { + exitWithPerror("socket() error\n" + String(strerror(errno))); + } + + memset(&serverAddr_[i], 0, sizeof(serverAddr_[i])); + serverAddr_[i].sin_family = AF_INET; + serverAddr_[i].sin_addr.s_addr = htonl(INADDR_ANY); + serverAddr_[i].sin_port = htons(atoi(port_[i + 1])); + } + portnum_ = portNumber_ - 1; } Server::~Server() { - delete[] serverSocket_; - delete[] serverAddr_; + delete[] serverSocket_; + delete[] serverAddr_; } void Server::myBind() { - int ret; - - for (int i = i; i < portnum_; i++) { - ret = bind(serverSocket_[i], reinterpret_cast(&serverAddr_[i]), sizeof(serverAddr_[i])); - if (ret == -1) { exitWithPerror("bind() error\n" + String(strerror(errno))); } - } - return ; + int ret; + + for (int i = i; i < portnum_; i++) { + ret = bind(serverSocket_[i], + reinterpret_cast(&serverAddr_[i]), + sizeof(serverAddr_[i])); + if (ret == -1) { + exitWithPerror("bind() error\n" + String(strerror(errno))); + } + } + return; } void Server::myListen() { - int ret; - - for (int i = 0; i < portnum_; i++) { - ret = listen(serverSocket_[i], 10); - if (ret == -1) { exitWithPerror("listen() error\n" + String(strerror(errno))); } - fcntl(serverSocket_[i], F_SETFL, O_NONBLOCK); - } + int ret; + + for (int i = 0; i < portnum_; i++) { + ret = listen(serverSocket_[i], 10); + if (ret == -1) { + exitWithPerror("listen() error\n" + String(strerror(errno))); + } + fcntl(serverSocket_[i], F_SETFL, O_NONBLOCK); + } } -int Server::mySetSockopt(int val , int fd) { - int ret; - - if (val == SO_REUSEADDR) { - int bf; - - for (int i = 0; i < portnum_; i++) { - ret = setsockopt(serverSocket_[i], SOL_SOCKET, SO_REUSEADDR, &bf, sizeof(bf)); - if (ret == -1) { exitWithPerror("setsockopt(SO_REUSERADDR) error\n" + String(strerror(errno))); } - COUT << "Socket(" << serverSocket_[i] << ")setting is succesed : SO_REUSEADDR" << CEND; - } - return (0); - } - else if (val == SO_LINGER) { - struct linger loption_; - - loption_.l_onoff = 1; - loption_.l_linger = 0; - - ret = setsockopt(fd, SOL_SOCKET, SO_LINGER, &loption_, sizeof(loption_)); - if (ret == -1) { exitWithPerror("setsockopt(SO_LINGER) error\n" + String(strerror(errno))); } - COUT << "Socket setting is succesed : SO_LINGER(" << fd << ")" << CEND; - return (0); - } - else { - CER << "Socket setting is failed." << CEND; - return (-1); - } - +int Server::mySetSockopt(int val, int fd) { + int ret; + + if (val == SO_REUSEADDR) { + int bf; + + for (int i = 0; i < portnum_; i++) { + ret = setsockopt(serverSocket_[i], SOL_SOCKET, SO_REUSEADDR, &bf, + sizeof(bf)); + if (ret == -1) { + exitWithPerror("setsockopt(SO_REUSERADDR) error\n" + + String(strerror(errno))); + } + COUT << "Socket(" << serverSocket_[i] + << ")setting is succesed : SO_REUSEADDR" << CEND; + } + return (0); + } else if (val == SO_LINGER) { + struct linger loption_; + + loption_.l_onoff = 1; + loption_.l_linger = 0; + + ret = setsockopt(fd, SOL_SOCKET, SO_LINGER, &loption_, sizeof(loption_)); + if (ret == -1) { + exitWithPerror("setsockopt(SO_LINGER) error\n" + String(strerror(errno))); + } + COUT << "Socket setting is succesed : SO_LINGER(" << fd << ")" << CEND; + return (0); + } else { + CER << "Socket setting is failed." << CEND; + return (-1); + } } -bool Server::IsServer(int fd) { - int ret = 0; +bool Server::IsServer(int fd) { + int ret = 0; - for (int i = 0; i < portnum_; i++) { - if (serverSocket_[i] == fd) - ret += 1 ; - } - return (ret); + for (int i = 0; i < portnum_; i++) { + if (serverSocket_[i] == fd) ret += 1; + } + return (ret); } -void Server::turnOn() { - kq_ = kqueue(); - if (kq_ == -1) { exitWithPerror("kq_ueue() error\n" + String (strerror(errno))); } - - for (int i = 0; i < portnum_; i++) { - changeEvents(changeList_, serverSocket_[i], EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, NULL); - COUT << "K-Page Server Started : " << serverSocket_[i] << CEND; - } - - int newEvents_; - struct kevent * currEvent_; - while(true) { - newEvents_ = kevent(kq_, &changeList_[0], changeList_.size(), eventList_, EVENT_MAX, nullptr); - if (newEvents_ == -1) { exitWithPerror("kevent() error\n" + String(strerror(errno))); } - - changeList_.clear(); - - for (int i = 0; i < newEvents_; ++i) { - currEvent_ = &eventList_[i]; - if (currEvent_->flags & EV_ERROR) { - for (int i = 0; i < portnum_; i ++) { - if (currEvent_->ident == serverSocket_[i]) - exitWithPerror("server socket error"); - else { - CER << "clients_ socket error" << CEND; - disconnectClients_(currEvent_->ident, clients_); - } - } - } - else if (currEvent_->filter == EVFILT_READ) { - if (IsServer(currEvent_->ident)) { - /* Accept new client */ - int clientS_ocket(accept(currEvent_->ident, NULL, NULL)); - - if (clientS_ocket == -1) { exitWithPerror("accept() error\n" + String(strerror(errno))); } - COUT << "accept new client : " << clientS_ocket << CEND; - fcntl(clientS_ocket, F_SETFL, O_NONBLOCK); - - /* add event for client socket - add read && write event */ - changeEvents(changeList_, clientS_ocket, EVFILT_READ, EV_ADD | EV_ENABLE | EV_EOF, 0, 0, NULL); - changeEvents(changeList_, clientS_ocket, EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, NULL); - mySetSockopt(SO_LINGER, clientS_ocket); - clients_[clientS_ocket] = ""; - } - else if (clients_.find(currEvent_->ident) != clients_.end()) { - /* read data from clients_ */ - char buf[1024]; - int n = recv(currEvent_->ident, buf, sizeof(buf), 0); - buf[n] = '\0'; - clients_[currEvent_->ident].append(buf); - COUT << "received data from " << currEvent_->ident << ":\n" << clients_[currEvent_->ident] << CEND; - } - } - else if (currEvent_->filter == EVFILT_WRITE) { - /* send Data to client*/ - std::map::iterator it = clients_.find(currEvent_->ident); - if (it != clients_.end()) { - int n; - n = send(currEvent_->ident, msg_.c_str(), strlen(msg_.c_str()), MSG_DONTWAIT); - clients_[currEvent_->ident].clear(); - disconnectClients_(currEvent_->ident, clients_); - } - } - } - } +void Server::turnOn() { + kq_ = kqueue(); + if (kq_ == -1) { + exitWithPerror("kq_ueue() error\n" + String(strerror(errno))); + } + + for (int i = 0; i < portnum_; i++) { + changeEvents(changeList_, serverSocket_[i], EVFILT_READ, EV_ADD | EV_ENABLE, + 0, 0, NULL); + COUT << "K-Page Server Started : " << serverSocket_[i] << CEND; + } + + int newEvents_; + struct kevent* currEvent_; + while (true) { + newEvents_ = kevent(kq_, &changeList_[0], changeList_.size(), eventList_, + EVENT_MAX, nullptr); + if (newEvents_ == -1) { + exitWithPerror("kevent() error\n" + String(strerror(errno))); + } + + changeList_.clear(); + + for (int i = 0; i < newEvents_; ++i) { + currEvent_ = &eventList_[i]; + if (currEvent_->flags & EV_ERROR) { + for (int i = 0; i < portnum_; i++) { + if (currEvent_->ident == serverSocket_[i]) + exitWithPerror("server socket error"); + else { + CER << "clients_ socket error" << CEND; + disconnectClients(currEvent_->ident, clients_); + } + } + } else if (currEvent_->filter == EVFILT_READ) { + if (IsServer(currEvent_->ident)) { + /* Accept new client */ + int clientS_ocket(accept(currEvent_->ident, NULL, NULL)); + + if (clientS_ocket == -1) { + exitWithPerror("accept() error\n" + String(strerror(errno))); + } + COUT << "accept new client : " << clientS_ocket << CEND; + fcntl(clientS_ocket, F_SETFL, O_NONBLOCK); + + /* add event for client socket - add read && write event */ + changeEvents(changeList_, clientS_ocket, EVFILT_READ, + EV_ADD | EV_ENABLE | EV_EOF, 0, 0, NULL); + mySetSockopt(SO_LINGER, clientS_ocket); + clients_[clientS_ocket] = ""; + } else if (clients_.find(currEvent_->ident) != clients_.end()) { + /* read data from clients_ */ + char buf[1024]; + int n = recv(currEvent_->ident, buf, sizeof(buf), 0); + if (n == 0) { + disconnectClients(currEvent_->ident, clients_); + clients_[currEvent_->ident].clear(); + } else { + buf[n] = '\0'; + clients_[currEvent_->ident].append(buf); + COUT << "received data from " << currEvent_->ident << ":\n" + << clients_[currEvent_->ident] << CEND; + size_t firstLine_ = clients_[currEvent_->ident].find('\n'); + String firstLineString_ = + clients_[currEvent_->ident].substr(0, firstLine_); + size_t srcStart = firstLineString_.find(' '); + size_t srcEnd = firstLineString_.find(' ', srcStart + 1); + String srcLine = firstLineString_.substr(srcStart + 1, srcEnd - 4); + /* send Data to client*/ + if (srcLine == "/") { + std::map::iterator it = + clients_.find(currEvent_->ident); + if (it != clients_.end()) { + int n; + n = send(currEvent_->ident, msg_.c_str(), strlen(msg_.c_str()), + MSG_DONTWAIT); + if (n == -1) { + disconnectClients(currEvent_->ident, clients_); + exitWithPerror("client write error"); + } else if (n == 0) + disconnectClients(currEvent_->ident, clients_); + else + clients_[currEvent_->ident].clear(); + } + } else { + srcLine.erase(0, 1); + srcLine.insert(0, DEFAULTLLOCATION); + std::ifstream fileEntity_; + fileEntity_.open(srcLine); + if (!fileEntity_.good()) { + break; + } + + int lengthFirst; + int lengthSecond; + + fileEntity_.seekg(0, fileEntity_.end); + lengthFirst = fileEntity_.tellg(); + fileEntity_.seekg(0, fileEntity_.beg); + + // char* buffer = new char[lengthFirst + 1]; + // buffer[lengthFirst] = '\0'; + // fileEntity_.read(buffer, lengthFirst); + + // std::ifstream httpmsg_; + // httpmsg_.seekg(0, httpmsg_.end); + // lengthSecond = httpmsg_.tellg(); + // httpmsg_.open(String(DEFAULTLLOCATION).append(HTTP), + // std::ifstream::in); + // httpmsg_.seekg(0, httpmsg_.beg); + // char* buffer2 = new char[lengthSecond + 1]; + // buffer2[lengthSecond] = '\0'; + // httpmsg_.read(buffer2, lengthSecond); + + // String fileMsg_; + // fileMsg_.append(buffer2); + // size_t pos = fileMsg_.find("3059"); + // fileMsg_.erase(pos, 4); + // char length[100]; + // sprintf(length, "%d", lengthFirst); + // fileMsg_.insert(pos, length); + // fileMsg_.push_back(static_cast(13)); + // fileMsg_.append("\n"); + + // char* totalMsg_ = new char[lengthFirst + lengthSecond + 1]; + // totalMsg_[lengthFirst + lengthSecond] = '\n'; + // strcpy(totalMsg_, fileMsg_.c_str()); + // strcpy(totalMsg_ + lengthSecond, buffer); + + // int k; + + // k = send(currEvent_->ident, totalMsg_, strlen(totalMsg_), + // MSG_DONTWAIT); + // if (k == -1) { + // disconnectClients(currEvent_->ident, clients_); + // exitWithPerror("client write error"); + // } else if (n == 0) + // disconnectClients(currEvent_->ident, clients_); + // else + // clients_[currEvent_->ident].clear(); + + // fileEntity_.close(); + // httpmsg_.close(); + // delete[] buffer2; + // delete[] buffer; + // delete[] totalMsg_; + } + } + } + } + } + } } -void Server::showYourSelf() { - for (int i = 0; i < portnum_; i++) { - COUT << "Server Socket : " << this->serverSocket_[i] << CEND; - COUT << "Server Port : " << ntohs(this->serverAddr_[i].sin_port) << CEND; - } +void Server::showYourSelf() { + for (int i = 0; i < portnum_; i++) { + COUT << "Server Socket : " << this->serverSocket_[i] << CEND; + COUT << "Server Port : " << ntohs(this->serverAddr_[i].sin_port) << CEND; + } } -void Server::fileSetting(const char * path) { - std::ifstream httpmsg_; - std::ifstream entity; - String entityloc(DEFAULTLLOCATION); +void Server::fileSetting(const char* path) { + std::ifstream httpmsg_; + std::ifstream entity; + String entityloc(DEFAULTLLOCATION); - httpmsg_.open(String(DEFAULTLLOCATION).append(HTTP), std::ifstream::in); - entityloc.append(path); + httpmsg_.open(String(DEFAULTLLOCATION).append(HTTP), std::ifstream::in); + entityloc.append(path); - COUT << entityloc << CEND; + COUT << entityloc << CEND; - entity.open(entityloc.c_str(), std::ifstream::in); + entity.open(entityloc.c_str(), std::ifstream::in); - int lengthFirst; - int lengthSecond; + int lengthFirst; + int lengthSecond; - httpmsg_.seekg(0, httpmsg_.end); - lengthFirst = httpmsg_.tellg(); - httpmsg_.seekg(0, httpmsg_.beg); + httpmsg_.seekg(0, httpmsg_.end); + lengthFirst = httpmsg_.tellg(); + httpmsg_.seekg(0, httpmsg_.beg); - entity.seekg(0, entity.end); - lengthSecond = entity.tellg(); - entity.seekg(0, entity.beg); + entity.seekg(0, entity.end); + lengthSecond = entity.tellg(); + entity.seekg(0, entity.beg); - char * buffer1 = new char[lengthFirst + 1]; - char * buffer2 = new char[lengthSecond + 1]; - buffer1[lengthFirst] = '\0'; - buffer2[lengthSecond] = '\0'; + char* buffer1 = new char[lengthFirst + 1]; + char* buffer2 = new char[lengthSecond + 1]; + buffer1[lengthFirst] = '\0'; + buffer2[lengthSecond] = '\0'; - httpmsg_.read(buffer1, lengthFirst); - entity.read(buffer2, lengthSecond); + httpmsg_.read(buffer1, lengthFirst); + entity.read(buffer2, lengthSecond); - msg_.append(buffer1); - msg_.push_back(static_cast(13)); - msg_.append("\n"); - msg_.append(buffer2); + msg_.append(buffer1); + msg_.push_back(static_cast(13)); + msg_.append("\n"); + msg_.append(buffer2); + delete[] buffer1; + delete[] buffer2; } -int main(int ac, char **av) { - Server myServer(ac, av); - - myServer.myBind(); - myServer.myListen(); - myServer.showYourSelf(); - myServer.mySetSockopt(SO_REUSEADDR, 0); - myServer.fileSetting(INDEX); - myServer.turnOn(); - - return 0; +int main(int ac, char** av) { + Server myServer(ac, av); + + myServer.myBind(); + myServer.myListen(); + myServer.showYourSelf(); + myServer.mySetSockopt(SO_REUSEADDR, 0); + myServer.fileSetting(INDEX); + myServer.turnOn(); + + return 0; } \ No newline at end of file diff --git a/haryu/study/kserver/k_class_page.hpp b/haryu/study/kserver/k_class_page.hpp index b2ff0db..a711b59 100644 --- a/haryu/study/kserver/k_class_page.hpp +++ b/haryu/study/kserver/k_class_page.hpp @@ -1,44 +1,45 @@ #ifndef k_class_page_hpp_ -# define k_class_page_hpp_ +#define k_class_page_hpp_ -#include -#include -#include #include #include -#include // atoi +#include // atoi +#include +#include +#include #include +#include #include +#include #include #include -#include #include -#include - +#include #define String std::string -#define COUT std::cout +#define COUT std::cout #define CEND std::endl #define CER std::cerr #define VEC std::vector #define MAP std::map #ifndef EVENT_MAX -# define EVENT_MAX 100 +#define EVENT_MAX 100 #endif #ifndef REUSE -# define REUSE 1 -#endif +#define REUSE 1 +#endif #ifndef LINGER -# define LINGER 1 +#define LINGER 1 #endif #ifndef DEFAULTLOCATION -# define DEFAULTLLOCATION "/Users/haryu/workspace/echoServer/haryu/study/kserver/" -#endif +#define DEFAULTLLOCATION \ + "/Users/haryu/workspace/echoServer/haryu/study/kserver/" +#endif #define HTTP "httpmsg" #define INDEX "index.html" @@ -46,28 +47,31 @@ #define SRC "/src/" class Server { -private : - int * serverSocket_; - struct sockaddr_in * serverAddr_; - int portnum_; - int kq_; - MAP clients_; - VEC changeList_; - struct kevent eventList_[EVENT_MAX]; - String msg_; + private: + int* serverSocket_; + struct sockaddr_in* serverAddr_; + int portnum_; + int kq_; + MAP clients_; + VEC changeList_; + struct kevent eventList_[EVENT_MAX]; + String msg_; + + void exitWithPerror(const String& msg_); + void changeEvents(VEC& changeList_, uintptr_t ident, + int16_t filter, uint16_t flags, uint16_t fflags, + intptr_t data, void* udata); + void disconnectClients(int clientFd, MAP& clients_); - void exitWithPerror(const String& msg_); - void changeEvents(VEC& changeList_, uintptr_t ident, int16_t filter, uint16_t flags, uint16_t fflags, intptr_t data, void* udata); - void disconnectClients_(int clientFd, MAP& clients_); -public: - Server(int portNumber_, char **port_); - ~Server(void); - void myBind(); - void myListen(); - int mySetSockopt(int val , int fd); - bool IsServer(int fd); - void turnOn(); - void showYourSelf(); - void fileSetting(const char * path); + public: + Server(int portNumber_, char** port_); + ~Server(void); + void myBind(); + void myListen(); + int mySetSockopt(int val, int fd); + bool IsServer(int fd); + void turnOn(); + void showYourSelf(); + void fileSetting(const char* path); }; #endif \ No newline at end of file diff --git a/haryu/study/kserver/khttpserver b/haryu/study/kserver/khttpserver new file mode 100755 index 0000000..753c525 Binary files /dev/null and b/haryu/study/kserver/khttpserver differ diff --git a/silee/.vscode/settings.json b/silee/.vscode/settings.json deleted file mode 100644 index cef3641..0000000 --- a/silee/.vscode/settings.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "files.associations": { - "exception": "cpp", - "__bit_reference": "cpp", - "__bits": "cpp", - "__config": "cpp", - "__debug": "cpp", - "__errc": "cpp", - "__hash_table": "cpp", - "__locale": "cpp", - "__mutex_base": "cpp", - "__node_handle": "cpp", - "__nullptr": "cpp", - "__split_buffer": "cpp", - "__string": "cpp", - "__threading_support": "cpp", - "__tuple": "cpp", - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "initializer_list": "cpp", - "ios": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "locale": "cpp", - "memory": "cpp", - "mutex": "cpp", - "new": "cpp", - "optional": "cpp", - "ostream": "cpp", - "ratio": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "typeinfo": "cpp", - "unordered_map": "cpp", - "variant": "cpp", - "vector": "cpp", - "__functional_base": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "utility": "cpp" - } -} \ No newline at end of file