日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

C语言 socket shutdown()函数(将与 sockfd 关联的套接字上的全双工连接全部或部分关闭)

發布時間:2025/3/20 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C语言 socket shutdown()函数(将与 sockfd 关联的套接字上的全双工连接全部或部分关闭) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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() 調用導致與 sockfd 關聯的套接字上的全雙工連接全部或部分關閉。 //如果 SHUT_RD 是怎樣的,則不允許進一步的接收。 //如果 SHUT_WR 怎樣,則不允許進一步傳輸。 如果 SHUT_RDWR 怎么樣,將不允許進一步的接收和傳輸。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()函數

總結

以上是生活随笔為你收集整理的C语言 socket shutdown()函数(将与 sockfd 关联的套接字上的全双工连接全部或部分关闭)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。