![]() |
ServerSocket Class Reference#include <ServerSocket.h>
Detailed Description
Definition at line 8 of file ServerSocket.h. Constructor & Destructor Documentation
Member Function Documentation
Definition at line 20 of file ServerSocket.cpp. 00021 { 00022 if (cmd == "QUIT") 00023 { 00024 Send("BYE\n\n"); 00025 SetCloseAndDelete(); 00026 } 00027 else 00028 if (cmd == "TIME") 00029 { 00030 time_t t = time(NULL); 00031 struct tm* tp = localtime(&t); 00032 char datetime[40]; 00033 sprintf(datetime,"%d-%02d-%02d %02d:%02d:%02d", 00034 tp -> tm_year + 1900, 00035 tp -> tm_mon + 1, 00036 tp -> tm_mday, 00037 tp -> tm_hour, 00038 tp -> tm_min, 00039 tp -> tm_sec); 00040 std::string reply = "TIME: "; 00041 reply += datetime; 00042 reply += "\n"; 00043 for (int i = 0; i < 10; i++) 00044 Send(reply); 00045 Send("\n"); 00046 } 00047 else 00048 if (cmd == "HELP") 00049 { 00050 Send("Commands supported: QUIT TIME HELP\n\n"); 00051 } 00052 else 00053 { 00054 Send("404 Not found\n\n"); 00055 } 00056 }
The documentation for this class was generated from the following files: |