sockets.h 608 B

12345678910111213141516171819202122232425262728
  1. #include <stdbool.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <sys/types.h>
  5. #ifdef _WIN32
  6. #include <winsock.h>
  7. #else
  8. #include <arpa/inet.h> /* definition of inet_ntoa */
  9. #include <errno.h>
  10. #include <fcntl.h>
  11. #include <netdb.h> /* definition of gethostbyname */
  12. #include <netinet/in.h> /* definition of struct sockaddr_in */
  13. #include <stdlib.h>
  14. #include <sys/socket.h>
  15. #include <sys/time.h>
  16. #include <unistd.h> /* definition of close */
  17. #endif
  18. int create_socket_server(int port);
  19. bool socket_cleanup();
  20. int socket_accept(int server_fd);
  21. bool socket_set_non_blocking(int fd);
  22. int fd;
  23. int sfd;