大门|大门-CS-2015(第2组)|问题65

根据UNIX套接字API,确定服务器进程调用函数调用accept、bind、listen和recv的正确顺序。 (A) 听,接受,约束 (B) 束缚,倾听,接受,接受 (C) 束缚,接受,倾听,接受 (D) 接受、倾听、约束、接受 答复: (B) 说明: 接受,接受,听着 服务器端 套接字API函数 .

null

bind() associates a socket with a socket address structure, 
i.e. a specified local port number and IP address.

listen() causes a bound TCP socket to enter listening state.

accept() accepts a received incoming attempt to create a new
TCP connection from the remote client, 

recv() is used to receive data from a remote socket. 

服务器必须首先执行bind()来告诉操作系统它将要列出的端口号,然后它必须侦听接收绑定端口号上的传入连接请求。一旦建立连接,服务器使用accept()接受,然后开始使用recv()接收数据。 这个问题的小测验

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享