本文介绍了Unix套接字编程-getpeername()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户端(linux)使用getpeername(),如果中断(ctrl C)服务器,函数返回-1并且客户端给出消息:无法连接到服务器.但是服务器(unix)使用相同的getpeername ()如果中断客户端,则funcn返回值为0.
服务器如何知道客户端被中断(Ctrl C)?

The client (linux) uses the getpeername() and if interrupt (ctrl C)server,function returns -1 and client gives the message : can''t connect to server.But the server (unix)uses the same getpeername() if interrupt client, the funcn return value is 0.
How does the server knows the client is interrupted (ctrl C)?

推荐答案


这篇关于Unix套接字编程-getpeername()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 21:35