27 #if defined(__linux__) || defined(__APPLE__)
29 #include <arpa/inet.h>
30 #include <netinet/in.h>
31 #include <sys/socket.h>
34 #define cf_socket_data_t void
35 #define cf_socket_size_t size_t
37 #define cf_close(fd) (close(fd))
44 cf_socket_read_timeout(
int fd, uint8_t *buf,
size_t buf_len, uint64_t trans_deadline,
int attempt_ms);
46 cf_socket_write_timeout(
int fd, uint8_t *buf,
size_t buf_len, uint64_t trans_deadline,
int attempt_ms);
48 cf_socket_read_forever(
int fd, uint8_t *buf,
size_t buf_len);
50 cf_socket_write_forever(
int fd, uint8_t *buf,
size_t buf_len);
53 cf_print_sockaddr_in(
char *prefix,
struct sockaddr_in *sa_in);
56 #if defined(__APPLE__)
57 #define MSG_NOSIGNAL SO_NOSIGPIPE
60 #if defined(CF_WINDOWS)
64 #define cf_socket_data_t char
65 #define cf_socket_size_t int
67 #define cf_close(fd) (closesocket(fd))
69 #define MSG_DONTWAIT 0
70 #define MSG_NOSIGNAL 0
72 #define SHUT_RDWR SD_BOTH
int cf_socket_start_connect_nb(int fd, struct sockaddr_in *sa)
int cf_socket_create_nb()
int cf_socket_create_and_connect_nb(struct sockaddr_in *sa)