feat update server

This commit is contained in:
tqcq
2025-07-17 15:52:27 +08:00
parent 9e327eeac4
commit 70a74d8770
2 changed files with 58 additions and 55 deletions

1
.gitignore vendored
View File

@@ -46,4 +46,5 @@ CTestTestfile.cmake
_deps
build/
.cache/
vcpkg_installed

View File

@@ -1,14 +1,16 @@
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <netdb.h>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char **argv) {
int
main(int argc, char **argv)
{
// Flush after every std::cout / std::cerr
std::cout << std::unitbuf;
std::cerr << std::unitbuf;
@@ -48,14 +50,14 @@ int main(int argc, char **argv) {
std::cout << "Waiting for a client to connect...\n";
// You can use print statements as follows for debugging, they'll be visible when running tests.
std::cout << "Logs from your program will appear here!\n";
// std::cout << "Logs from your program will appear here!\n";
// Uncomment this block to pass the first stage
//
// accept(server_fd, (struct sockaddr *) &client_addr, (socklen_t *) &client_addr_len);
// std::cout << "Client connected\n";
accept(server_fd, (struct sockaddr *) &client_addr, (socklen_t *) &client_addr_len);
std::cout << "Client connected\n";
//
// close(server_fd);
close(server_fd);
return 0;
}