【问题标题】:Calling bind() twice in a row连续调用两次 bind()
【发布时间】:2019-05-09 21:21:56
【问题描述】:

我想知道,在创建服务器时,如果你调用 bind() 然后再次调用 bind() 而不做任何其他事情会发生什么。

【问题讨论】:

  • 我没有尝试,但它应该给出错误EINVAL The socket is already bound to an address.
  • 我同意@stark 但你为什么不试试看看会发生什么?

标签: c sockets


【解决方案1】:

根据 linux 手册页,您将获得:

   EINVAL The socket is already bound to an address.

基于以下标准:

   POSIX.1-2001,  POSIX.1-2008,  SVr4,  4.4BSD

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-30
    • 2012-02-21
    • 2023-04-01
    相关资源
    最近更新 更多