【发布时间】:2019-05-09 21:21:56
【问题描述】:
我想知道,在创建服务器时,如果你调用 bind() 然后再次调用 bind() 而不做任何其他事情会发生什么。
【问题讨论】:
-
我没有尝试,但它应该给出错误
EINVAL The socket is already bound to an address. -
我同意@stark 但你为什么不试试看看会发生什么?
我想知道,在创建服务器时,如果你调用 bind() 然后再次调用 bind() 而不做任何其他事情会发生什么。
【问题讨论】:
EINVAL The socket is already bound to an address.
根据 linux 手册页,您将获得:
EINVAL The socket is already bound to an address.
基于以下标准:
POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD
【讨论】: