C语言 socket shutdown()函数(将与 sockfd 关联的套接字上的全双工连接全部或部分关闭)
生活随笔
收集整理的這篇文章主要介紹了
C语言 socket shutdown()函数(将与 sockfd 关联的套接字上的全双工连接全部或部分关闭)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
man 2 文檔
[root@ubuntu /arnold_test/20220324_hikflow_demo__socket_server_test]102# man -f shutdown shutdown (8) - Halt, power-off or reboot the machine shutdown (2) - shut down part of a full-duplex connection shutdown (3posix) - shut down socket send and receive operations SHUTDOWN(2) Linux Programmer's Manual SHUTDOWN(2)NAMEshutdown - shut down part of a full-duplex connectionSYNOPSIS#include <sys/socket.h>int shutdown(int sockfd, int how);DESCRIPTIONThe shutdown() call causes all or part of a full-duplex connection on the socket associated with sockfd to be shut down. If how is SHUT_RD, further recep‐tions will be disallowed. If how is SHUT_WR, further transmissions will be disallowed. If how is SHUT_RDWR, further receptions and transmissions will bedisallowed.//shutdown() 調(diào)用導(dǎo)致與 sockfd 關(guān)聯(lián)的套接字上的全雙工連接全部或部分關(guān)閉。 //如果 SHUT_RD 是怎樣的,則不允許進(jìn)一步的接收。 //如果 SHUT_WR 怎樣,則不允許進(jìn)一步傳輸。 如果 SHUT_RDWR 怎么樣,將不允許進(jìn)一步的接收和傳輸。RETURN VALUEOn success, zero is returned. On error, -1 is returned, and errno is set appropriately.ERRORSEBADF sockfd is not a valid descriptor.EINVAL An invalid value was specified in how (but see BUGS).ENOTCONNThe specified socket is not connected.ENOTSOCKThe file descriptor sockfd does not refer to a socket.CONFORMING TOPOSIX.1-2001, POSIX.1-2008, 4.4BSD (shutdown() first appeared in 4.2BSD).NOTESThe constants SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, respectively, and are defined in <sys/socket.h> since glibc-2.1.91.BUGSChecks for the validity of how are done in domain-specific code, and before Linux 3.7 not all domains performed these checks. Most notably, UNIX domainsockets simply ignored invalid values. This problem was fixed for UNIX domain sockets in Linux 3.7.SEE ALSOconnect(2), socket(2), socket(7)COLOPHONThis page is part of release 4.04 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest versionof this page, can be found at http://www.kernel.org/doc/man-pages/.Linux 2015-12-28 SHUTDOWN(2)參考文章:socket–shutdown()函數(shù)
總結(jié)
以上是生活随笔為你收集整理的C语言 socket shutdown()函数(将与 sockfd 关联的套接字上的全双工连接全部或部分关闭)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: win11怎么使用ie浏览器?(ie兼容
- 下一篇: ftp上传文件报错:ftp recv: