1 Star 0 Fork 4.9K

罗小黑 / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
socket-h.md 13.30 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

socket.h

Overview

Related Modules:

NET

Description:

Provides functions and data structures related to network operations.

For example, you can use the functions to send and receive network data, manage network addresses, and convert bytes.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

sockaddr

Describes the socket address information.

Macros

Macro Name and Value

Description

SOL_SOCKET   1

Defines options for socket level.

Functions

Function Name

Description

socket (int domain, int type, int protocol)

int 

Creates a socket and returns its descriptor.

shutdown (int sockfd, int how)

int 

Shuts down a socket.

bind (int sockfd, const struct sockaddr *addr, socklen_t addrlen)

int 

Binds a local protocol address to a socket.

connect (int sockfd, const struct sockaddr *addr, socklen_t addrlen)

int 

Initiates a connection to a socket.

listen (int sockfd, int backlog)

int 

Listens for network connections.

accept (int sockfd, struct sockaddr *__restrict addr, socklen_t *__restrict addrlen)

int 

Accepts incoming connection requests.

getsockname (int fd, struct sockaddr *restrict addr, socklen_t *restrict len)

int 

Retrieves the local address of the specified socket.

getpeername (int fd, struct sockaddr *restrict addr, socklen_t *restrict len)

int 

Retrieves the peer address of the specified socket.

send (int fd, const void *buf, size_t len, int flags)

ssize_t 

Sends data to another socket.

recv (int fd, void *buf, size_t len, int flags)

ssize_t 

Receives data from another socket.

sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)

ssize_t 

Sends data to another socket.

recvfrom (int fd, void *__restrict buf, size_t len, int flags, struct sockaddr *__restrict addr, socklen_t *__restrict alen)

ssize_t 

Receives data from a specified socket.

sendmsg (int fd, const struct msghdr *msg, int flags)

ssize_t 

Sends data to another socket.

recvmsg (int fd, struct msghdr *msg, int flags)

ssize_t 

Receives data from a specified socket.

getsockopt (int fd, int level, int optname, void *__restrict optval, socklen_t *__restrict optlen)

int 

Retrieves the socket options.

setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)

int 

Sets the socket options.

1
https://gitee.com/lawguiren/docs.git
git@gitee.com:lawguiren/docs.git
lawguiren
docs
docs
master

搜索帮助