|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Cross-platform socket interface for ascii-chat. More...
Go to the source code of this file.
Macros | |
| #define | INVALID_SOCKET_VALUE (-1) |
| Invalid socket value (POSIX: -1) | |
| #define | SOCKET_ERROR_WOULDBLOCK EWOULDBLOCK |
| #define | SOCKET_ERROR_INPROGRESS EINPROGRESS |
| #define | SOCKET_ERROR_AGAIN EAGAIN |
Typedefs | |
| typedef int | socket_t |
| Socket handle type (POSIX: int) | |
Functions | |
| asciichat_error_t | socket_init (void) |
| Initialize socket subsystem (required on Windows) | |
| void | socket_cleanup (void) |
| Cleanup socket subsystem. | |
| socket_t | socket_create (int domain, int type, int protocol) |
| Create a new socket. | |
| int | socket_close (socket_t sock) |
| Close a socket. | |
| int | socket_bind (socket_t sock, const struct sockaddr *addr, socklen_t addrlen) |
| Bind a socket to an address. | |
| int | socket_listen (socket_t sock, int backlog) |
| Listen for incoming connections. | |
| socket_t | socket_accept (socket_t sock, struct sockaddr *addr, socklen_t *addrlen) |
| Accept an incoming connection. | |
| int | socket_connect (socket_t sock, const struct sockaddr *addr, socklen_t addrlen) |
| Connect to a remote address. | |
| ssize_t | socket_send (socket_t sock, const void *buf, size_t len, int flags) |
| Send data on a socket. | |
| ssize_t | socket_recv (socket_t sock, void *buf, size_t len, int flags) |
| Receive data from a socket. | |
| ssize_t | socket_sendto (socket_t sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) |
| Send data to a specific address (UDP) | |
| ssize_t | socket_recvfrom (socket_t sock, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) |
| Receive data from a specific address (UDP) | |
| int | socket_setsockopt (socket_t sock, int level, int optname, const void *optval, socklen_t optlen) |
| Set socket option. | |
| int | socket_getsockopt (socket_t sock, int level, int optname, void *optval, socklen_t *optlen) |
| Get socket option. | |
| int | socket_shutdown (socket_t sock, int how) |
| Shutdown socket I/O. | |
| int | socket_getpeername (socket_t sock, struct sockaddr *addr, socklen_t *addrlen) |
| Get peer address. | |
| int | socket_getsockname (socket_t sock, struct sockaddr *addr, socklen_t *addrlen) |
| Get socket local address. | |
| int | socket_set_blocking (socket_t sock) |
| Set socket to blocking mode. | |
| int | socket_set_nonblocking (socket_t sock, bool nonblocking) |
| Set socket to non-blocking mode. | |
| int | socket_set_reuseaddr (socket_t sock, bool reuse) |
| Set SO_REUSEADDR socket option. | |
| int | socket_set_nodelay (socket_t sock, bool nodelay) |
| Set TCP_NODELAY socket option (disable Nagle's algorithm) | |
| int | socket_set_keepalive (socket_t sock, bool keepalive) |
| Set SO_KEEPALIVE socket option. | |
| int | socket_set_keepalive_params (socket_t sock, bool enable, int idle, int interval, int count) |
| Set TCP keepalive parameters. | |
| int | socket_set_linger (socket_t sock, bool enable, int timeout) |
| Set SO_LINGER socket option. | |
| int | socket_set_timeout (socket_t sock, uint32_t timeout_ms) |
| Set socket receive and send timeouts. | |
| int | socket_set_buffer_sizes (socket_t sock, int recv_size, int send_size) |
| Set socket buffer sizes. | |
| int | socket_get_peer_address (socket_t sock, struct sockaddr *addr, socklen_t *addrlen) |
| Get peer address (convenience function) | |
| int | socket_get_error (socket_t sock) |
| Get socket-specific error code. | |
| void | socket_optimize_for_streaming (socket_t sock) |
| Optimize socket for high-throughput video streaming. | |
| int | socket_get_last_error (void) |
| Get last socket error code. | |
| const char * | socket_get_error_string (void) |
| Get last socket error as string. | |
| int | socket_poll (struct pollfd *fds, nfds_t nfds, int timeout) |
| Poll sockets for events. | |
| int | socket_select (socket_t max_fd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) |
| Select sockets for I/O readiness. | |
| void | socket_fd_zero (fd_set *set) |
| Clear an fd_set. | |
| void | socket_fd_set (socket_t sock, fd_set *set) |
| Add a socket to an fd_set. | |
| int | socket_fd_isset (socket_t sock, fd_set *set) |
| Check if a socket is in an fd_set. | |
| int | socket_get_fd (socket_t sock) |
| Get the underlying file descriptor (POSIX compatibility) | |
| bool | socket_is_valid (socket_t sock) |
| Check if a socket handle is valid. | |
Cross-platform socket interface for ascii-chat.
Definition in file socket.h.