简体   繁体   中英

recv() returning 0 in a netlink socket

In a networking socket between two host, recv() return value will be 0 when the peer in the other end has performed an orderly shutdown.

what is the meaning of recv() returning 0 in a netlink socket(to communicate between userspace and kernel) listening in userspace? for example, in user space listening for netlink message from kernel of type RTM_NEWLINK anf family NETLINK_ROUTE.

In a networking socket between two host, recv() return value will be 0 when the peer in the other end has performed an orderly shutdown.

That's not what it says in the man page. It says

The return value will be 0 when the peer has performed an orderly shutdown.

The part about 'in a networking socket between two hosts' is your invention.

The specification there applies to recv(), period.

what is the meaning of recv() returning 0 in a netlink socket(to communicate between userspace and kernel) listening in userspace? for example, in user space listening for netlink message from kernel of type RTM_NEWLINK anf family NETLINK_ROUTE.

The meaning is exactly the same. It's a socket, it's connected, recv() returns zero => the peer has performed an orderly shutdown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM