| 57 | } |
| 58 | |
| 59 | int NetIO::Accept(const int &fd) { |
| 60 | struct sockaddr_in client_addr; |
| 61 | socklen_t length = sizeof(client_addr); |
| 62 | |
| 63 | int conn = accept(fd, (struct sockaddr*) &client_addr, &length); |
| 64 | if (conn < 0) { |
| 65 | ColorLogError("accent fail fd %d", fd); |
| 66 | return SOCKET_FAIL; |
| 67 | } |
| 68 | return conn; |
| 69 | } |
| 70 | |
| 71 | int NetIO::Connect(const char *ip, const uint32_t &port) { |
| 72 | int sock_cli = socket(AF_INET, SOCK_STREAM, 0); |
nothing calls this directly
no test coverage detected