#include <errno.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <iostream> int main(int argc, char **argv) { int socket_fd = socket(PF_INET, SOCK_STREAM, 0); if (socket_fd == -1) { std::cerr << strerror(errno) << std::endl; return EXIT_FAILURE; } close(socket_fd); return EXIT_SUCCESS; }