如何在AF_INET中获取客户端IP地址 [英] How to get client ip address in AF_INET

查看:124
本文介绍了如何在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!

推荐答案

也许会帮助您:
http://www.geekpage.jp/en/programming/linux-network/get- ipaddr.php [ ^ ]
http://stackoverflow.com/Questions/5401942/how-to-get-get-the-ip-address-of-the-accepted-in-bound-socket [ ^ ]
Maybe it will help you:
http://www.geekpage.jp/en/programming/linux-network/get-ipaddr.php[^]
http://stackoverflow.com/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_INET中获取客户端IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆