“关闭”功能对udp套接字有什么影响?
int shutdown(int socket, int how);
在UDP套接字上调用shutdown()
在线路上没有任何作用,仅影响套接字对象的状态。
查看内核:
__sys_shutdown()
calls sock->ops->shutdown()
在套接字对象上。 sock->ops->shutdown()
是ops
。struct proto_ops
),AF_INET
设置为inet_stream_ops.shutdown
。inet_stream_ops.shutdown
非常面向TCP,有点麻烦。但是,它是inet_shutdown
。
[inet_shutdown
inet_shutdown
a checks sk->sk_prot->shutdown
and calls it if it is non-NULL:
sk->sk_prot->shutdown
sk_prot
操作(points to)struct proto
struct proto tcp_prot