gpt4 book ai didi

c - 如果在 BSD 套接字上多次调用 close() 会发生什么

转载 作者:行者123 更新时间:2023-12-03 11:51:17 24 4
gpt4 key购买 nike

在 BSD 套接字上调用 close() 是否安全 socketfd多次?

最佳答案

来自 manual :

close() returns zero on success. On error, -1 is returned, and errno is set appropriately.

ERRORS

  EBADF  fd isn’t a valid open file descriptor.


所以按理说 close调用将因上述错误而失败。 (这确实是我的机器上发生的事情。)

关于c - 如果在 BSD 套接字上多次调用 close() 会发生什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12463473/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com