首页 > 代码库 > APUE:网络IPC:套接字

APUE:网络IPC:套接字

#define	AF_UNSPEC	PF_UNSPEC
#define	AF_LOCAL	PF_LOCAL
#define	AF_UNIX		PF_UNIX
#define	AF_INET		PF_INET
#define	AF_INET6	PF_INET6

enum __socket_type
{
  SOCK_STREAM = 1,		/* Sequenced, reliable, connection-based
				   byte streams.  */
  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
				   of fixed maximum length.  */
  SOCK_RAW = 3,			/* Raw protocol interface.  */
};


int socket (int __domain, int __type, int __protocol);

int shutdown (int __fd, int __how);
int close (int __fd);

int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
int listen (int __fd, int __n);
int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len);

int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);

int getsockname (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len);
int getpeername (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len);

ssize_t send (int __fd, const void *__buf, size_t __n, int __flags);
ssize_t sendto (int __fd, const void *__buf, size_t __n, int __flags, __CONST_SOCKADDR_ARG __addr, socklen_t __addr_len);
ssize_t sendmsg (int __fd, const struct msghdr *__message, int __flags);

ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len);
ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);

int getsockopt (int __fd, int __level, int __optname, void *__restrict __optval, socklen_t *__restrict __optlen);
int setsockopt (int __fd, int __level, int __optname, const void *__optval, socklen_t __optlen);

  

APUE:网络IPC:套接字