2023-07-27 14:37:10 +00:00
|
|
|
/* sys/socket.h: Communication sockets. */
|
|
|
|
|
|
|
|
#ifndef _SYS_SOCKET_H
|
|
|
|
#define _SYS_SOCKET_H
|
|
|
|
|
|
|
|
#include <bits/socket.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Create a new socket and return a file descriptor pointing to it. */
|
|
|
|
int socket(int domain, int type, int protocol);
|
|
|
|
|
|
|
|
/* Bind a socket to an address. */
|
2023-08-11 16:00:15 +00:00
|
|
|
int bind(int sockfd, const struct sockaddr* addr, socklen_t addrlen);
|
2023-07-27 14:37:10 +00:00
|
|
|
|
2023-07-28 15:30:59 +00:00
|
|
|
/* Connect a socket to a remote address. */
|
2023-08-11 16:00:15 +00:00
|
|
|
int connect(int sockfd, const struct sockaddr* addr, socklen_t addrlen);
|
2023-07-28 15:30:59 +00:00
|
|
|
|
|
|
|
/* Start listening on a socket. */
|
|
|
|
int listen(int sockfd, int backlog);
|
|
|
|
|
|
|
|
/* Wait for an incoming connection on a socket. */
|
|
|
|
int accept(int sockfd, struct sockaddr* addr, socklen_t* addrlen);
|
|
|
|
|
2023-07-27 14:37:10 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|