ç获取IP收听服务器 [英] C Get IP for listening server

查看:208
本文介绍了ç获取IP收听服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写使用C套接字的客户机/服务器程序。我指定服务器可以通过使用sockaddr_in.sin_addr.s_addr任何INADDR_ANY网络接口上监听。这相当于0.0.0.0一个IP。是否有可能对我来说,获得实际的IP,该服务器监听? (例如:192.168.1.100)

I am writing a client/server program using C sockets. I am specifying that the server can listen on any network interface by using INADDR_ANY in sockaddr_in.sin_addr.s_addr. This is equivalent to an IP of 0.0.0.0. Is it possible for me to get the actual IP that the server is listening on? (e.g. 192.168.1.100)

推荐答案

我终于能够找到的解决方案,工程

修改:链接死这么看:<一href=\"http://web.archive.org/web/20120219193513/http://guy-lecky-thompson.suite101.com/socket-programming-gethostbyname-a19557\"相对=nofollow>互联网档案链接。

希望它可以帮助他人,因为它一直在我身上。

Hopefully it can be helpful to others as it has been to me.

这篇关于ç获取IP收听服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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