请问高手,如何用python2.5编写解析动态ip的软件
请问下,用python2.5如何编写解析动态ip软件,需要相关的模块吗?
[解决办法]
可以用python的socket模块:
>>> import socket>>> socket.getaddrinfo("www.google.com", 80)4: [(2, 1, 6, '', ('74.125.115.104', 80)), (2, 2, 17, '', ('74.125.115.104', 80)), (2, 3, 0, '', ('74.125.115.104', 80)), (2, 1, 6, '', ('74.125.115.106', 80)), (2, 2, 17, '', ('74.125.115.106', 80)), (2, 3, 0, '', ('74.125.115.106', 80)), (2, 1, 6, '', ('74.125.115.103', 80)), (2, 2, 17, '', ('74.125.115.103', 80)), (2, 3, 0, '', ('74.125.115.103', 80)), (2, 1, 6, '', ('74.125.115.147', 80)), (2, 2, 17, '', ('74.125.115.147', 80)), (2, 3, 0, '', ('74.125.115.147', 80)), (2, 1, 6, '', ('74.125.115.105', 80)), (2, 2, 17, '', ('74.125.115.105', 80)), (2, 3, 0, '', ('74.125.115.105', 80)), (2, 1, 6, '', ('74.125.115.99', 80)), (2, 2, 17, '', ('74.125.115.99', 80)), (2, 3, 0, '', ('74.125.115.99', 80))]
[解决办法]
如果是在客户端,则动态ip和静态ip没有什么区别。
如果你的程序是在服务器一端,想发布、更新你的ip地址,可以看看dyndnsc是怎么做的。
[解决办法]
那得要有个中间的东西?比如两个QQ用户能通信,那是因为有腾讯服务器。
[解决办法]