本文介绍了如何在AF_INET中获取客户端IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取AF_INET中的客户端IP地址? 我想写一个程序做为监听器! 并记录输入信息!
how can i get client ip address in AF_INET ? I want to write a program does as a listener! and log input information!
推荐答案也许会帮助您: www.geekpage.jp/en/programming/linux-network/get- ipaddr.php [ ^ ] stackoverflow/Questions/5401942/how-to-get-get-the-ip-address-of-the-accepted-in-bound-socket [ ^ ] Maybe it will help you: www.geekpage.jp/en/programming/linux-network/get-ipaddr.php[^] stackoverflow/questions/5401942/how-to-get-the-ip-address-of-the-accepted-in-bound-socket[^]
不完全确定这是您的意思,但是您可以为 accept [ ^ ]调用(您可以使用它接受来自客户端),其中填满了客户端的IP和端口. Google提供了"accept socket"以获取更多信息和可能的示例. Not completely sure this is what you mean, but you can specify a struct to the accept[^] call (you use this to accept connection requests from clients) that is filled with the client''s IP and port. Google for "accept socket" for more information and possible examples.
更多推荐
如何在AF
发布评论